How can you implement multi-selection and Contextual ActionMode in ActionBarSherlock?

So here’s what I did. Edit: Over a year passed since I found out the previous answer had alot of useless code (woops) and the CAB thing can be achieved with much less effort and a cleaner code, so I took some time and updated it The LibraryFragment ListView should be defined with choice mode … Read more

Contextual Actionbar styles

To change the color/etc of the text in a contextual action bar: public boolean onCreateActionMode(ActionMode mode, Menu menu) { //mode.setTitle(“Contextual Action Bar”); (replace this call) TextView tv= (TextView)getLayoutInflater().inflate(R.layout.contextual_title, null); tv.setText(“Contextual Action Bar”); mode.setCustomView(tv); where layout/contextual_title.xml contains a single TextView with your desired color/size/style etc In fact, almost everything in a contextual action bar can be … Read more

Custom cut/copy action bar for EditText that shows text selection handles

I figured out the answer to my own question; TextView (and therefore EditText) has a method setCustomSelectionActionModeCallback() which should be used instead of startActionMode(). Using this enables customisation of the menu used by TextView for text selection. Sample code: bodyView.setCustomSelectionActionModeCallback(new StyleCallback()); where StyleCallback customises the text selection menu by removing Select All and adding some … Read more