Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

android

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

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

In a older android phone, the back button is removed with these two code lines. However with the nexus 4, the back button still appears but is just disabled. Also I am just adding a menu item on the right that behaves like the back/home button replacing the back/home button. What am I missing?

like image 893
RyanCW Avatar asked Mar 10 '14 23:03

RyanCW


People also ask

How do I remove the back icon from my android toolbar?

Touch “Settings” -> “Display” -> “Navigation bar” -> “Full screen gestures”. The navigation bar will be hidden and you will be shown “Gesture demos” to explain how to operate the “Go back”, “Go to Home screen” and “Open Recents” functions.

How can I customize my action bar in android?

This example demonstrate about how to create a custom action bar in Android. Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main. xml.

How do I get rid of the back button on my house?

Please navigate to Android->Advanced Restrictions->Display Settings. Uncheck the 'Hide navigation bar' option. This will disable the on-screen buttons: back, home and recent apps.


1 Answers

Use getActionBar().setDisplayHomeAsUpEnabled(false) to remove the home button from the action bar.

like image 144
ElectronicGeek Avatar answered Sep 30 '22 14:09

ElectronicGeek