I'm using Appcompat v22 to use tinted style for AutoCompleteTextView. However, as soon as I changed my build.gradle from this:
compile 'com.android.support:support-v4:21.0.3' compile 'com.android.support:appcompat-v7:21.0.3' compile 'com.android.support:cardview-v7:21.0.2' compile 'com.android.support:recyclerview-v7:21.0.2'
to this:
compile 'com.android.support:support-v4:22.0.0' compile 'com.android.support:appcompat-v7:22.0.0' compile 'com.android.support:gridlayout-v7:22.0.0' compile 'com.android.support:cardview-v7:22.0.0'
The ActionBarDrawerToggle Icon (Hamburger icon) goes missing. (However, if I slide from left, the drawer gets revealed)
Inside onCreate():
mDrawerLayout = (BBDrawerLayout) findViewById(R.id.drawer_layout); mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.string.drawer_open, R.string.drawer_close) { @Override public void onDrawerClosed(View drawerView) { super.onDrawerClosed(drawerView); toolbar.setTitle(mTitle); invalidateOptionsMenu(); } @Override public void onDrawerOpened(View drawerView) { super.onDrawerOpened(drawerView); trackEvent(TrackingAware.MENU_SHOWN, null); toolbar.setTitle(mDrawerTitle); invalidateOptionsMenu(); } }; mDrawerLayout.setDrawerListener(mDrawerToggle);
Have also called syncState()
@Override protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); if (mDrawerToggle != null) { mDrawerToggle.syncState(); } } @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); if (mDrawerToggle != null) { mDrawerToggle.onConfigurationChanged(newConfig); } }
If I downgrade the appcompat version back to 21.0.3, everything starts to work.
The relevant part is in the last line of code, I have them in my Activity.onCreate(..)
method:
_drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, 0, 0); drawerLayout.setDrawerListener(_drawerToggle); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
As I remember that line is documented too but in appcompat v21 they were ignored (or at least the default was different..)
For those encountering the same problem as Dapp (toggle showing back arrow instead of hamburger icon), this is most likely because you're missing a drawerToggle.syncState()
in your Activity.
To be more specific, you have to override the onPostCreate() method like this :
@Override protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); drawerToggle.syncState(); }
This isn't the only method that needs to be overriden. See this post by jpardogo for more details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With