0
我目前有一個問題顯示操作欄上的選項菜單項。出於某種原因,這些項目僅在溢出菜單上顯示,對於後期ICS設備也是如此。我正在使用v7-appcompat庫來支持從版本8開始的sdks。ActionBar菜單圖標只顯示在溢出菜單
在主要活動我:
@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" />
我似乎無法繞過它。
在微調和/或TextView中已經放在這我不清楚。你能告訴你如何將它們添加到你的動作欄嗎?你的活動是否擴展了ActionBarActivity? –
Hi Paul, 是的,我正在使用ActionBarActivity擴展。我使用標準的ActionBar將導航模式設置爲列表,然後基於此實例化適配器。 但我發現問題更多的是在造型方面。 – Switch