9

I have created a new project in eclipse with the navigation drawer and instead of the three lines icon on the top left of the screen I have the back arrow icon. I have found nothing on stack over flow which seems to help. I have tried to change the setDisplayHomeAsUpEnabled and setHomeButtonEnabled but it does not help here is a part of the code (by the way its the default code from eclipse) any one have and idea? enter image description here

3
  • Please check the icon, it might as well not be the three lines icon that you want, replace the icon properly. Also check in your code where from exactly that back icon seems to come
    – akash89
    Commented Jun 13, 2015 at 13:24
  • i have checked the icon and its a 3 lines and in all resolutions folders
    – WolfJee
    Commented Jun 13, 2015 at 13:29
  • 1
    guys if you dont have the answer just do not reply as i told you i searched about 20 different topics on stackoverflow
    – WolfJee
    Commented Jun 13, 2015 at 13:37

3 Answers 3

7

I believe you can try setting custom activity back button to Hamburger button.

Here is the code.

So you can change it programmatically easily by using homeAsUpIndicator() function that added in android API level 18 and upper.

ActionBar().setHomeAsUpIndicator(R.drawable.ic_yourindicator);

If you use support library

getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_yourindicator);
6

You can change your styles.xml file to replace the navigation drawer icon adding this code:

<item name="homeAsUpIndicator">@drawable/ic_drawer</item>
<item name="android:homeAsUpIndicator">@drawable/ic_drawer</item>

The ic_drawer icon (which you'll put in drawable folder) can be downloaded on the web.

1
  • One note: these <item> tags should be added as children of <style> tag. Commented Mar 4, 2016 at 22:46
1

To sync the state of the drawer indicator/affordance with the linked DrawerLayout just add code below to your activity

@Override
protected void onPostCreate(Bundle savedInstanceState) {
    super.onPostCreate(savedInstanceState);
    // Sync the toggle state after onRestoreInstanceState has occurred.
    mDrawerToggle.syncState();
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.