I want to show the Overflow menu on ImageButton
click.
menu/menu_scrollable_tab.xml
<menu xmlns:android="http://schemas.android.com/apk/res/android"
tools:context="com.example.scrollingtab.activity.ScrollableTabsActivity">
<item android:id="@+id/action_settings"
android:title="@string/action_settings"
android:orderInCategory="100"
app:showAsAction="always"
android:icon="@drawable/info" />
<item android:id="@+id/action_settings1"
android:title="@string/action_settings"
android:orderInCategory="100"
app:showAsAction="never" />
<item android:id="@+id/action_settings2"
android:title="@string/action_settings"
android:orderInCategory="100"
app:showAsAction="never" />
</menu>
I have disabled the default Action bar and created Action bar using layout. I am not using default action bar or toolbar since i need to customize the action bar more.
layout/actionbar.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="50dp" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="50dp"
android:orientation="horizontal"
android:background="@color/actionbar_bg"
android:weightSum="2">
<ImageButton android:id="@+id/ib_navigation"
android:background="@drawable/nv_drawer_24x24"
android:layout_width="0dp"
android:layout_weight=".3"
android:layout_height="50dp"/>
<View
android:layout_width="0dp"
android:layout_height="50dp"
android:layout_weight="1.1"/>
<ImageButton android:id="@+id/ib_navigation1"
android:background="@drawable/info"
android:layout_width="0dp"
android:layout_weight=".3"
android:layout_height="50dp"/>
<ImageButton android:id="@+id/ib_navigation2"
android:background="@drawable/ic_drawer"
android:layout_width="0dp"
android:layout_weight=".3"
android:layout_height="50dp"/>
</LinearLayout>
</RelativeLayout>
As per the client requirement I have designed the action bar using layout and the look and feel are good.
The default OnCreateOptionsMenu(Menu menu)
method is not populating the overflow menu. Now i want to populate the overflow menu on clicking the ImageButton
with id= ib_navigation2
. I don't have any idea to implement this.
Can any one help me on doing this.
Thanks