Search code examples
androidandroid-actionbaractionbarsherlock

How can I align the ActionMode done button on the right of the ActionBar instead of the left?


As the title stands, is there a way to align the ActionMode Done Button on the right instead of the left? Or Should I hide it and add a menu button and manage its onClick?


Solution

  • Right after you call "startActionMode" , you can find the view of the actionMode, and set its layout direction (or investigate it and then do what you wish) :

    // <= call "startActionMode" here
    final View actionModeView = findViewById(R.id.action_mode_bar);
    if (actionModeView != null)
       actionModeView.setLayoutDirection(View.LAYOUT_DIRECTION_LTR);
    

    I know that it works at least for Toolbar (when being set as an actionBar), using the support library.