1
votes

I need to display action bar overflow icon in my app without any child menu item, and I need to display a drawer while clicking the action bar overflow icon.

Using below code the overflow icon not showing, where as adding an item to menu display the icon.

Is it possible to display overflow icon without any content on it? Also I need to get click event of overflow icon, is it possible?.

<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    tools:context="com.ibeacon.vapplicaspecials.MainActivity" >

   <item
    android:id="@+id/overflow"
    android:orderInCategory="100"
    android:showAsAction="always"
    android:title="">

</item>

</menu>

And in main activity

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.main, menu);

    return super.onCreateOptionsMenu(menu);
}
1

1 Answers

1
votes

If your activities are extending AppCompat, I suggest you use android.support.v7.widget.Toolbar. Its much easier to use and you don't have to have all of the extra methods for action bar. You can put icons, custom animations, etc... Its also very good choice when considering implementing material design animations and functions.

Android: How to/Tutorial for changing ActionBar to ActionBarCompat (Toolbar)?