Remove default home/up button in action mode

964 Views Asked by At

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.

3

There are 3 best solutions below

1
On

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
}
0
On

Try this,

getActionBar().setDisplayHomeAsUpEnabled(false);

OR

getSupportActionBar().setDisplayHomeAsUpEnabled(false);

this may helps you.

0
On

You can remove action button home up enabled through ::

if you are using support v7 lib then

getSupportActionBar().setDisplayHomeAsUpEnabled(false);

else 

getActionBar().setDisplayHomeAsUpEnabled(false);