0

我创建了一个带有菜单(关于、设置、退出)的 android 应用程序,在我的智能手机上运行良好,但不适用于平板电脑。我如何修复它?这是我的代码......适用于智能手机......

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

 @Override 
 public boolean onOptionsItemSelected(MenuItem item)
 {

  switch (item.getItemId())
  {
  case R.id.menu_exit:

      locationManager.removeUpdates(this);
       // wl.release();

      finish();
      return true;

  case R.id.menu_about:

      locationManager.removeUpdates(this);
       // wl.release();

      startActivity(new Intent(this, About.class));
      return true;    

  case R.id.menu_sos:

      locationManager.removeUpdates(this);
        //wl.release();

      startActivity(new Intent(this, sos.class));
      return true;

  case R.id.menu_map:

      locationManager.removeUpdates(this);
        //wl.release();
      Intent i = new Intent(getApplicationContext(), MarineNavigator.class); //Send current location to map
     i.putExtra("latcur",lat);
     i.putExtra("lngcur",lng);
     startActivity(i);

      return true;        

  case R.id.menu_setup_map: 

      locationManager.removeUpdates(this);
        //wl.release();

      startActivity(new Intent(this, Setup2.class));
      return true;            


  default:
      return super.onOptionsItemSelected(item);
  }
}

我对此进行了测试...用于平板电脑和工作....但没有显示任何图标或充气任何东西只是转到下一个活动...我如何修改它以适合我?一些添加代码?示例?谢谢。

   public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
              //Default generate when we make app on Eclipse...
    getMenuInflater().inflate(R.menu.marine_navigator, menu);

    locationManager.removeUpdates(this);

  Intent i = new Intent(getApplicationContext(), MarineNavigator.class); //Send current location to map
     i.putExtra("latcur",lat);
     i.putExtra("lngcur",lng);
     startActivity(i);

    return true;
}
4

0 回答 0