URL and Link repository

Saturday, July 1, 2017

Problem with Android Lollipop ( 5.1.1) Action Bar and Tool Bar

PROBLEM: Hamburger icon in the ActionBar/ToolBar is not clickable, but a swipe from the left displays the drawer layout with menu items.
RESOLUTION: Use the CORRECT constructor for ActionBarDrawerToggle:
ActionBarDrawerToggle (Activity activity, 
DrawerLayout drawerLayout,
Toolbar toolbar, ◄ - THIS IS THE KEY. Previously missing.
int openDrawerContentDescRes,
int closeDrawerContentDescRes)
The main activity should extend AppCompatActivity.
and create an instance of android.support.v7.widget.Toolbar
There are plenty of full code examples online but remember to setSupportActionBar(toolbar); and that is it!
Here is what my build.gradle looks like:
android {
compileSdkVersion 21
buildToolsVersion "21.1.0"
minSdkVersion 11
targetSdkVersion 21

No comments:

Post a Comment