Android之Menu菜单 onCreateOptionsMenu使用Menu按键显示不了问题

 
@Override
 public boolean  onCreateOptionsMenu(Menu menu) {
  super.onCreateOptionsMenu(menu);
  MenuInflater menuInflater = this.getMenuInflater();
  menuInflater.inflate(R.menu.menu, menu);
  return true;
 }

 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
  int selectId = item.getItemId();
  switch (selectId) {
  case R.id.new_dir:
   newDir();
   break;
  case R.id.del:
   delFileSelected();
   break;
  case R.id.move:
   moveDir();
   break;
  case R.id.setting:
   setting();
   break;
  case R.id.exit:
   exit();
   break;
  case R.id.adbout:
   about();
   break;
  }
  return true;
 }


不清楚什么原因程序按下Menu一直没有反应,最后只能直接通过KeyEvent事件调用openOptionsMenu()来显示我定义好的菜单项

你可能感兴趣的:(android,menu)