大佬教程收集整理的这篇文章主要介绍了android – 在ActionBar中的菜单项上添加复选框,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
这是我的menu.xml:
<menu xmlns:android="http://scheR_715_11845@as.android.com/apk/res/android" xmlns:app="http://scheR_715_11845@as.android.com/apk/res-auto" xmlns:tools="http://scheR_715_11845@as.android.com/tools" tools:context="com.tracking.bus.maps.SingleViewMapsActivity" > <item android:id="@+id/actionbar_alarm" android@R_505_6964@="@String/actionbar_alarm" app:actionViewClass="android.widget.checkBox" app:showAsAction="ifRoom"/> </menu>
<?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://scheR_715_11845@as.android.com/apk/res/android"> <!-- checkable items appear only in submenus or context menus. --> <!-- Carefully look at the attribute name checkableBehavior on groups,but the attribute name checkable on items. The checkableBehavior encompasses the number of items that will be checkable within that group. --> <item android@R_505_6964@="None"> <menu> <!-- The none checkableBehavior is default,but we explicitly show it here. --> <group android:id="@+id/noncheckable_group" android:checkableBehavior="none"> <!-- Notice how these items inherit from the group. --> <item android:id="@+id/noncheckable_item_1" android@R_505_6964@="@String/item_1" /> <item android:id="@+id/noncheckable_item_2" android@R_505_6964@="@String/item_2" /> <item android:id="@+id/noncheckable_item_3" android@R_505_6964@="@String/item_3" /> </group> </menu> </item> <item android@R_505_6964@="All"> <menu> <group android:id="@+id/checkable_group" android:checkableBehavior="all"> <!-- Notice how these items inherit from the group. --> <item android:id="@+id/checkable_item_1" android@R_505_6964@="@String/item_1" /> <item android:id="@+id/checkable_item_2" android:checked="true" android@R_505_6964@="@String/item_2" /> <item android:id="@+id/checkable_item_3" android:checked="true" android@R_505_6964@="@String/item_3" /> </group> </menu> </item> <item android@R_505_6964@="Single"> <menu> <group android:id="@+id/exclusive_checkable_group" android:checkableBehavior="single"> <!-- Notice how these items inherit from the group. --> <item android:id="@+id/exclusive_checkable_item_1" android@R_505_6964@="@String/item_1" /> <item android:id="@+id/exclusive_checkable_item_2" android@R_505_6964@="@String/item_2" /> <item android:id="@+id/exclusive_checkable_item_3" android:checked="true" android@R_505_6964@="@String/item_3" /> </group> </menu> </item> <item android@R_505_6964@="All without group"> <menu> <!-- Notice how these items have each set. --> <item android:id="@+id/nongroup_checkable_item_1" android:checkable="true" android@R_505_6964@="@String/item_1" /> <item android:id="@+id/nongroup_checkable_item_2" android:checkable="true" android:checked="true" android@R_505_6964@="@String/item_2" /> <item android:id="@+id/nongroup_checkable_item_3" android:checkable="true" android:checked="true" android@R_505_6964@="@String/item_3" /> </menu> </item> </menu>
以上是大佬教程为你收集整理的android – 在ActionBar中的菜单项上添加复选框全部内容,希望文章能够帮你解决android – 在ActionBar中的菜单项上添加复选框所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。