Android Menu: Two single-checkable groups in the same menu

后端 未结 2 1316
無奈伤痛
無奈伤痛 2021-01-18 14:22

My xml code is:


    
    

        
相关标签:
2条回答
  • 2021-01-18 15:04

    Use:

    compile 'com.android.support:appcompat-v7:23.1.0'
    compile 'com.android.support:design:23.1.0'
    
    0 讨论(0)
  • 2021-01-18 15:05

    You just need to add unique IDs to each of the group items in the xml file.

    <group
        android:id="@+id/menuGroup_1"           <!-- Here -->
        android:checkableBehavior="single">
        <item android:id="@+id/group_1_box_1"/>
        <item android:id="@+id/group_1_box_2"/>
    </group>
    
    <group
        android:id="@+id/menuGroup_2"           <!-- And here -->
        android:checkableBehavior="single">
        <item android:id="@+id/group_2_box_1"/>
        <item android:id="@+id/group_2_box_2"/>
    </group>
    
    0 讨论(0)
提交回复
热议问题