我目前正在遇到一个问题,显示了动作栏上的选项菜单项。由于某些原因,这些项目仅在溢出菜单上显示,并且对于帖子ICS设备也是如此。我正在使用V7-AppCompat库来支持第8版的SDK。
在主要活动中我有:
@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" />
我似乎无法绕过它。
太好了,我发现该问题与我现在已经解决的动作栏样式定义中的不匹配有关:
<style name="ActionBarStyle" parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">