【发布时间】:2013-12-04 22:48:52
【问题描述】:
我按照这个链接Here在Android项目中创建选项菜单的步骤@
但是在将它应用到我的项目而不是选项菜单垂直出现(4 行)之后,它出现了水平(4 个项目除以 2 行) 这里的问题可能是我的代码
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
switch (item.getItemId()) {
case R.id.Settings:
// write code to execute when clicked on this option
Intent nextScreen3 = new Intent(getApplicationContext(), FirstSSettings.class);
startActivity(nextScreen3);
return true;
case R.id.Verify:
// write code to execute when clicked on this option
Intent nextScreen4 = new Intent(getApplicationContext(), Verify.class);
startActivity(nextScreen4);
return true;
case R.id.callInfo:
// startActivity(new Intent().setClass(MainActivity.this, LoginActivity.class).setData(getIntent().getData())); // write code to execute when clicked on this option
return true;
case R.id.email:
// write code to execute when clicked on this option
return true;
default:
return super.onOptionsItemSelected(item);
}
}
【问题讨论】:
-
你在哪个版本的 android 上测试这个?看起来该教程是在 4.0+ 手机上的,如果您使用的是 2.x 版本,它将看起来像您描述的那样。
-
4.3版还有其他可能的问题吗?
标签: android list view optionmenu