我目前在操作栏上显示选项菜单项时遇到问题。出于某种原因,这些项目仅显示在溢出菜单上,对于后 ICS 设备也是如此。我正在使用 v7-appcompat 库从版本 8 开始支持 sdks。
在主要活动中,我有:
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.wild_news, menu);
return true;
}
我的菜单项定义如下:
<menu xmlns:android="http://schemas.android.com/apk/res/android"
**xmlns:app="http://schemas.android.com/apk/res-auto"** >
<item
android:id="@+id/menu_refresh"
android:icon="@drawable/ic_action_refresh"
**app:showAsAction="always"**
android:title="@string/menuTitle_refresh"/>
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
**app:showAsAction="ifRoom"**
android:title="@string/action_settings"/>
我在操作栏中也有一个微调器,具有以下 xml 布局:
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="50dp"
android:minWidth="140dp"
android:layout_gravity="center_vertical"
style="@style/ActionBarNavListTitle" />
我似乎无法理解它。