Remove default home/up button in action mode

余生长醉 提交于 2019-12-24 08:22:12

问题


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.


回答1:


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
}



回答2:


Try this,

getActionBar().setDisplayHomeAsUpEnabled(false);

OR

getSupportActionBar().setDisplayHomeAsUpEnabled(false);

this may helps you.




回答3:


You can remove action button home up enabled through ::

if you are using support v7 lib then

getSupportActionBar().setDisplayHomeAsUpEnabled(false);

else 

getActionBar().setDisplayHomeAsUpEnabled(false);


来源:https://stackoverflow.com/questions/37697828/remove-default-home-up-button-in-action-mode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!