【发布时间】:2014-12-12 12:07:58
【问题描述】:
我正在使用 app compact 支持库 v7 在我的应用程序中提供对棒棒糖的支持。我能够让它完美地工作。当我的操作栏没有将菜单项显示为图标时。
我已关注this link 使其工作。
以下是我的 menu.xml :
<menu xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/contact_add"
android:icon="@drawable/ic_btn_add_contact"
android:title="@string/add"
app:showAsAction="always"/>
<item
android:id="@+id/contact_delete"
android:icon="@drawable/ic_btn_add_contact"
android:showAsAction="never"
android:title="@string/delete"/>
</menu>
我仍然收到以下错误:should use android:showAsAction when not using appcompat library
我做错了什么???
【问题讨论】:
-
我认为你的父母是 Activity 类。
-
@TusharPandey:我曾尝试使用
ifRoom仍然存在问题。我在片段中使用此菜单,但该活动的父级正在扩展ActionBarActivity。 -
或者可能是您使用的是三星设备,设备中的菜单按钮会显示溢出。
标签: android android-fragments android-actionbar menuitem android-support-library