Android学习之menu
2010-05-31 14:13:00 来源:WEB开发网12. < item android:id="@+id/group_item1"
13. android:title="Item 1 in group"
14. / >
15. < item android:id="@+id/group_item2"
16. android:title="Item 2 in group"
17. android:checked="true"
18. / >
19. < /group >
20.
21. < item android:id="@+id/submenu"
22. android:title="Sub Menu" >
23. < menu >
24. < item android:id="@+id/submenu_item"
25. android:title="Sub Menu Item"
26. / >
27. < /menu >
28. < /item >
29.
30. < item android:id="@+id/item3"
31. android:title="item 3"
32. android:checkable="true"
33. android:checked="true"
34. / >
35.
36. < /menu >
< ?xml version="1.0" encoding="utf-8"? > < menu xmlns:android="http://schemas.android.com/apk/res/android" > < item android:id="@+id/item1" android:title="Item 1" android:icon="@drawable/icon" android:checkable="true" android:checked="false" / > < group android:id="@+id/group_1" android:checkableBehavior="single" > < item android:id="@+id/group_item1" android:title="Item 1 in group" / > < item android:id="@+id/group_item2" android:title="Item 2 in group" android:checked="true" / > < /group > < item android:id="@+id/submenu" android:title="Sub Menu" > < menu > < item android:id="@+id/submenu_item" android:title="Sub Menu Item" / > < /menu > < /item > < item android:id="@+id/item3" android:title="item 3" android:checkable="true" android:checked="true" / > < /menu >
Java代码
view plaincopy to clipboardprint?
1. public void onCreate(Bundle savedInstanceState) {
2. ...
3. registerForContextMenu(editText);
更多精彩
赞助商链接