私は現在、ActionBar を持つアプリを開発しています。
API 8 までのデバイスをサポートする必要があるため、Google のサポート ライブラリ v7 を使用しました。
さて...私のmenu-xmlは次のようになります:(これはテスト活動のみです)
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" >
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
android:icon="@drawable/ic_launcher"
app:showAsAction="never"
android:title="@string/action_settings"/>
</menu>
そして私のコード:
package standard.test;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
public class test extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_test);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.test, menu);
return true;
}
}
その結果、アイコンが表示されません。Galaxy S3のハードウェアオプションボタンをクリックした場合にのみアイテムを利用できます。
確かに十分なスペースがあります。