简体   繁体   中英

Remove default home/up button in action mode

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.

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
}

Try this,

getActionBar().setDisplayHomeAsUpEnabled(false);

OR

getSupportActionBar().setDisplayHomeAsUpEnabled(false);

this may helps you.

You can remove action button home up enabled through ::

if you are using support v7 lib then

getSupportActionBar().setDisplayHomeAsUpEnabled(false);

else 

getActionBar().setDisplayHomeAsUpEnabled(false);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM