我只有一个菜单项。菜单位于页面底部。虽然我在xml文件中使用了withText | always。我甚至尝试了ifRoom | withText但标题没有显示在菜单中。仅显示图标。长按菜单项会显示带有项目标题的烤面包。
的xml:
<menu xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<item
android:id="@+id/fbmenu"
android:icon="@drawable/fb"
android:title="@string/likeus"
android:orderInCategory="400"
android:showAsAction="withText|always" />
</menu>
Java文件:
public boolean onCreateOptionsMenu(android.view.Menu menu) {
super.onCreateOptionsMenu(menu);
MenuInflater blowup = getMenuInflater();
blowup.inflate(R.menu.fbmenu, menu);
return true;
以下是app的屏幕截图: http://i.stack.imgur.com/XD01c.png
答案 0 :(得分:0)
确保定位支持库namescape(app
):
<menu
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
...
app:showAsAction="ifRoom|withText"
android:showAsAction="ifRoom|withText"/>