how to hide up button in actionbar

前端 未结 4 2001
醉酒成梦
醉酒成梦 2021-01-02 17:16

I would like to do an edit mode, in the style of the tablet gmail app. If the user presses the edit button on the actionbar, than I would like to show him/her an action view

4条回答
  •  悲哀的现实
    2021-01-02 17:50

    Though it's an older post, I would like to share an answer which worked for me.

    To hide the UP button in actionbar, use the following in OnCreateOptionsMenu:

    if (getSupportActionBar() != 
               getSupportActionBar().hide();
           }
    

    To remove the UP button in actionbar, use the following in OnCreateOptionsMenu:

    if (getSupportActionBar() != 
               getSupportActionBar().setDisplayHomeAsUpEnabled(false);
           }
    

    I hope it will help newbies.

提交回复
热议问题