Skip to content Skip to sidebar Skip to footer

Custom Rows For Menu Items In Action Bar

I am trying to create kind of list view with custom rows in menu in action bar. something like this: I have searched a lot on web but could not find anything useful. How can I ac

Solution 1:

I had figured out after a while. If you want to list items with just icon and title in over flow menu, you need to do nesting of items within items or group them using menu tag.

<menu xmlns:android="http://schemas.android.com/apk/res/android" >    
    <item
        android:id="@+id/action_settings"
        android:icon="@drawable/ic_action_overflow"
        android:orderInCategory="100"
        android:showAsAction="always">
        <menu>
            <item
                android:id="@+id/add_source"
                android:icon="@drawable/add_on"
                android:orderInCategory="100"
                android:showAsAction="never"
                android:title="@string/add_source"/>
            <item
                android:id="@+id/channel_setup"
                android:icon="@drawable/channelsetup_on"
                android:orderInCategory="100"
                android:showAsAction="never"
                android:title="@string/channel_setup"/>
        </menu>
    </item>

    <item
        android:id="@+id/time"
        android:orderInCategory="99"
        android:showAsAction="always"
        android:title="@string/time_title"/>
    <item
        android:id="@+id/weather"
        android:icon="@drawable/ic_action_cloud"
        android:orderInCategory="98"
        android:showAsAction="always"
        android:title="@string/weather_title"/>
    <item
        android:id="@+id/search"
        android:actionViewClass="android.widget.SearchView"
        android:icon="@drawable/ic_action_search"
        android:orderInCategory="97"
        android:showAsAction="collapseActionView|always"
        android:title="@string/search_title"/>    
</menu>

Post a Comment for "Custom Rows For Menu Items In Action Bar"