我按照以下链接在此处的链接后在 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);
}
}