samedi 1 avril 2017

Can I add two different Android menus?

I am working on an Android app with 2 menus at the moment, both of them are single option click:

<item
        android:icon="@mipmap/it"
        android:title="IT"
        app:showAsAction="always">
        <menu
            android:id="@+id/theme1">
            <group android:checkableBehavior="single">
            <item
                android:id="@+id/it5"
                android:icon="@mipmap/it5"
                android:orderInCategory="1"
                android:title="it5" />

            <item
                android:id="@+id/it4"
                android:icon="@mipmap/it4"
                android:orderInCategory="2"
                android:title="it4" />
            </group>
        </menu>
    </item>

    <item
        android:icon="@mipmap/tb"
        android:title="TB"
        app:showAsAction="always">
        <menu
            android:id="@+id/theme2">
            <group android:checkableBehavior="single">

                <item
                    android:id="@+id/tb1"
                    android:title="tb1"
                    android:icon="@mipmap/tb1"
                    android:orderInCategory="1"/>
                <item
                    android:id="@+id/tb2"
                    android:icon="@mipmap/tb2"
                    android:orderInCategory="2"
                    android:title="tb2" />
            </group>
        </menu>
    </item>

It is working just fine and I have a Switch cases to see what option has been clicked. But What I want to add is a third menu with multiple check-boxes, so I got to check an number of them. I tires by updating <group android:checkableBehavior="all">. It looks like multiple check-boxes but I still cannot check them.




Aucun commentaire:

Enregistrer un commentaire