android: how to remove the back/home button in the action bar

后端 未结 9 1495
一向
一向 2020-12-29 02:20

I am having difficulties trying to remove the back/home button from the action bar.

 getActionBar().setDisplayShowHomeEnabled(false);   //disable back button         


        
相关标签:
9条回答
  • 2020-12-29 03:12

    You can use this code :

    toggle.setDrawerIndicatorEnabled(false);
    

    Works great for me.

    0 讨论(0)
  • 2020-12-29 03:14

    To control the up affordance, use setDisplayHomeAsUpEnabled().

    0 讨论(0)
  • 2020-12-29 03:18

    This code work for me

    For remove navigation bar getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);

    For remove status bar getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN);

    ฺBut above code, it show again when you touch on screen, so if you want static state, combine this code.

    getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE);

    0 讨论(0)
提交回复
热议问题