我的代码从 1.6 开始一直运行良好,但在升级到 4.3 后突然无法正常显示。
看起来绘制菜单的系统获得了错误的屏幕宽度值。
代码经过测试的任何想法!我尝试更改主题我没有想法!
它似乎只影响 4.x 设备。所有其他设备均不受影响。
在 onCreate 中具有所需的:-
if (android.os.Build.VERSION.SDK_INT>10)
getActionBar();
还
@Override
public boolean onCreateOptionsMenu(Menu menu) {
//super.onCreateOptionsMenu(menu);
if (!app().day_change){
menu.add(0,0,0,"<<Day");
menu.add(0,1,0,"Day>>");
}
menu.add(0,2,0,"Hot Sync");
menu.add(0,3,0,"Delete Week File");
menu.add(0,4,0,"Import Test Data File");
menu.add(0,5,0,"View Mod History");
menu.add(0,15,0,"View Changes to Data");
menu.add(0,6,0,"Select Bluetooth device");
menu.add(0,9,0,"View Auto Backup files");
menu.add(0,10,0,"Options");
//menu.add(0,7,0,"WIFI Print Test");
//menu.add(0,8,0,"Delnote Test");
return super.onCreateOptionsMenu(menu);
}
public boolean onPrepareOptionsMenu(Menu menu){
menu.clear();
if (!app().day_change){
menu.add(0,0,0,"<<Day");
menu.add(0,1,0,"Day>>");
}
menu.add(0,2,0,"Hot Sync");
menu.add(0,3,0,"Delete Week File");
menu.add(0,4,0,"Import Test Data File");
menu.add(0,5,0,"View Mod History");
menu.add(0,15,0,"View Changes to Data");
menu.add(0,6,0,"Select Bluetooth device");
menu.add(0,9,0,"View Auto Backup files");
menu.add(0,10,0,"Options");
menu.add(0,11,0,"SMS Invoicing");
subMenu = menu.addSubMenu("Contacts");
subMenu.add(0, 12, 0, " Update");
subMenu.add(0, 13, 0, " Delete All z");
menu.add(0,14,0,"Email Steve Weekfile");
//menu.add(0,7,0,"WIFI Print Test");
//menu.add(0,8,0,"Delnote Test");
return super.onPrepareOptionsMenu(menu);
}
这是 Nexus 7 的视图
非常感谢史蒂夫