1

I have created custom action mode which visible on long click on list item . There is default back/up button visible in actionMode.

Without change in style.xml , it's possible to remove default action mode back/up button from fragment/activity class.

Kindly help.

Vanraj Ghed
  • 1,261
  • 11
  • 23
user2021938
  • 145
  • 1
  • 1
  • 9

3 Answers3

1

Try this,

getActionBar().setDisplayHomeAsUpEnabled(false);

OR

getSupportActionBar().setDisplayHomeAsUpEnabled(false);

this may helps you.

Sathish Kumar J
  • 4,280
  • 1
  • 20
  • 48
0

Use the method: getActionBar().setDisplayHomeAsUpEnabled(false) to remove the home button from the action bar.

Example:

ActionBar actionBar = getActionBar();
if (actionBar != null) {
    actionBar.setHomeButtonEnabled(false); // disable the button
    actionBar.setDisplayHomeAsUpEnabled(false); // remove the left caret
    actionBar.setDisplayShowHomeEnabled(false); // remove the icon
}
Vinay Jayaram
  • 1,030
  • 9
  • 29
  • 1
    thanks but i am using actionMode = ((AppCompatActivity) getActivity()).startActionMode(actionModeCallback); in my fragment class. And this is for action bar but i am asking for contextual action mode . – user2021938 Jun 09 '16 at 06:00
0

You can remove action button home up enabled through ::

if you are using support v7 lib then

getSupportActionBar().setDisplayHomeAsUpEnabled(false);

else 

getActionBar().setDisplayHomeAsUpEnabled(false);
R_K
  • 803
  • 1
  • 7
  • 18