0

i'm literally new in developing android apps. My project using navigation drawer between fragments. i tried to custom the drawer with tutorial http://www.tutecentral.com/android-custom-navigation-drawer/ and got an error. in my application, in action bar, it keeps showing back icon instead the default icon.

this is url for before-after image of actionbar : http://oi58.tinypic.com/2ahsbys.jpg

here is the code i'm confused of (pretty same with the tutorial, tell me if there's something i missed)

    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setHomeButtonEnabled(true);

    mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout,
            R.drawable.ic_drawer, R.string.navigation_drawer_open,
            R.string.navigation_drawer_close) {
        public void onDrawerClosed(View view) {
            getSupportActionBar().setTitle(mTitle);
            invalidateOptionsMenu(); // creates call to
            // onPrepareOptionsMenu()
        }

        public void onDrawerOpened(View drawerView) {
            getSupportActionBar().setTitle(mDrawerTitle);
            invalidateOptionsMenu(); // creates call to
            // onPrepareOptionsMenu()
        }
    };

if i delete setDisplayHomeAsUpEnabled, the back icon is gone but i can't click somewhere to display the drawer, i have to slide it. please refer me if someone has solved it. many thanks.

*i have changed the R.drawable.ic_drawer to other drawable icons but it had no effects.

Afkar
  • 3
  • 3
  • Refer to my answer here. http://stackoverflow.com/a/29339935/4290431 – Pooja May 15 '15 at 03:50
  • [see this ans ][1] for show drawer menu icon [1]: http://stackoverflow.com/questions/29894923/navigation-drawer-doesnt-show-icon-in-actionbar/29895505#29895505 – Lokesh May 15 '15 at 10:21
  • thank you guys for your answer but i find random's answer works in the simplest way. @Pooja – Afkar May 15 '15 at 11:16

1 Answers1

1

Try setting a theme for your activity in manifest file and inside styles.xml set your drawable for homeAsUpIndicator for that theme

<style name="CustomTheme" parent="@style/Widget.AppCompat.ActionBar"> 
     <item name="homeAsUpIndicator">@drawable/ic_drawer</item> 
</style>
random
  • 10,238
  • 8
  • 57
  • 101