我想在 Android 支持库的操作栏中添加按钮。显示操作栏,但不显示任何按钮。
下面是 res/menu/main.xml
menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
android:showAsAction="always"
android:icon="@android:drawable/ic_menu_preferences"
android:title="@string/action_settings"/>
</menu>
我添加以下代码。
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
MenuInflater inflater=getMenuInflater();
inflater.inflate(R.menu.main, menu);
return true;
}
我应该怎么办??