1
我想這樣的菜單如何建立在Android的菜單
創建菜單,因爲當我不喜歡在鏈接是出現在頂部,我想下來作爲鏈接
這是我的Java文件看看這些代碼,我在等待答案請
@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.undo:
Toast.makeText(Map.this, "Bookmark is Selected", Toast.LENGTH_SHORT).show();
return true;
case R.id.track:
Toast.makeText(Map.this, "Save is Selected", Toast.LENGTH_SHORT).show();
return true;
case R.id.Hyper:
Toast.makeText(Map.this, "Search is Selected", Toast.LENGTH_SHORT).show();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
這是我的XML文件
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/undo"
android:icon="@drawable/icon_bookmark"
android:title="Bookmark" />
<item android:id="@+id/track"
android:icon="@drawable/icon_save"
android:title="Save" />
<item android:id="@+id/Hyper"
android:icon="@drawable/icon_search"
android:title="Search" />
</menu>
您可以發佈您的代碼。 –
請完整且準確地解釋**您的問題與您發佈的代碼有什麼關係。 – CommonsWare