Android Actionbar 项目为三个点 [英] Android Actionbar items as three dots
本文介绍了Android Actionbar 项目为三个点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的主要活动有一个菜单 (res/menu/main_menu.xml),我只希望操作栏上有一个项目,其余项目应隐藏在三点菜单下.
I have a menu for my main activity (res/menu/main_menu.xml) and I want only one item on the Actionbar and the rest shall be hidden under three dots menu.
问题是,我从来没有在我的操作栏上看到三个点的项目.为什么我看不到三个点的项目?如何强制项目隐藏在它下面?
The problem is, I never see the three dots item on my actionbar. Why I can't see three dots item? How to force items to be hidden under it?
注意:我使用 minSdkVersion="14" 并在 AVD 中进行测试.
Note: I use minSdkVersion="14" and I test in AVD.
推荐答案
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item android:id="@+id/menu_item_share"
android:title="@string/share"
android:icon="@android:drawable/ic_menu_share"
app:showAsAction="ifRoom"
android:actionProviderClass="android.widget.ShareActionProvider" />
<item
android:id="@+id/empty"
android:title="@string/options"
android:orderInCategory="101"
app:showAsAction="always"
android:icon="@drawable/baseline_more_vert_black">
<menu>
<item android:id="@+id/action_settings"
android:icon="@android:drawable/ic_menu_preferences"
app:showAsAction="ifRoom"
android:title="@string/settings" />
<item android:id="@+id/action_help"
android:icon="@android:drawable/ic_menu_help"
app:showAsAction="ifRoom"
android:title="@string/help" />
</menu>
</item>
</menu>
一旦您从 此处.
这篇关于Android Actionbar 项目为三个点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文