0
KitKat 4.4.2中的操作栏存在一个小问题。它不显示在所有...Android操作栏完全不显示(KitKat)
清单:
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
活动:
@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.menu_pre_login, menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
NavUtils.navigateUpFromSameTask(this);
return true;
case R.id.login:
Log.d("menu worked: ", "menu worked");
return true;
}
return super.onOptionsItemSelected(item);
}
发生了什么事是溢出菜单,或者它的项目没有任何显示。返回true或super()不起作用。任何想法是什么造成这种情况?
感谢
什么是您的'AppTheme'? – Ahmad
发布你的menu_pre_login xml – Libin
对不起,我已经通过将'onCreateOptionsMenu(Menu menu){}'方法添加到启动的主要活动中,而不仅仅是一个。它出现在所有活动中 –