I am trying to implement android Toolbar as action bar. My action bar should contain one logo as header and an overflow menu. Overflow menu icon color is green. I used a widget OverflowMenuButton but some exception is coming after adding this. I don't know how to correctly use this widget.
Here is my code
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="50dp"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
android:background="@color/white"
android:gravity="center">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="false"
android:focusable="false"
android:longClickable="false"
android:src="@drawable/logo_multi"/>
<OverflowMenuButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/green"/>
</android.support.v7.widget.Toolbar>
I am posting some of the error lines
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #20: Error inflating class OverflowMenuButton
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:713)
at android.support.v7.app.ActionBarActivityDelegateBase.setContentView(ActionBarActivityDelegateBase.java:228)
at android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:102)
at com.ragpicker.screen.StartScreen.onCreate(StartScreen.java:35)
at android.app.Activity.performCreate(Activity.java:5541)
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.OverflowMenuButton" on path: DexPathList[[zip file "/data/app/com.ragpicker-669.apk"],nativeLibraryDirectories=[/data/app-lib/com.ragpicker-669, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:67)
at android.support.v7.app.ActionBarActivityDelegateBase.setContentView(ActionBarActivityDelegateBase.java:228)
In oncreate,
setContentView(R.layout.screen_startscreen);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
if (toolbar != null) {
setSupportActionBar(toolbar);
}