我想用下面的顯示時,按菜單鍵的Android選項菜單佈局
--------------
- Logout -
--------------
- Profile -
--------------
- Password -
--------------
- Add -
--------------
但對以下設備的結果
----------------------
- Logout - Profile -
----------------------
- Password - add -
----------------------
怎麼看都像是在做菜單選項圖片在頂部,下面的源代碼
main.xml中
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/action_logout"
android:orderInCategory="100"
android:showAsAction="withText"
android:menuCategory="container"
android:title="@string/action_logout"/>
<item
android:id="@+id/action_password"
android:orderInCategory="100"
android:showAsAction="withText"
android:menuCategory="container"
android:title="@string/action_password"/>
<item
android:id="@+id/action_profile"
android:orderInCategory="100"
android:showAsAction="withText"
android:menuCategory="container"
android:title="@string/action_profile"/>
<item
android:id="@+id/action_sync"
android:orderInCategory="100"
android:showAsAction="withText"
android:menuCategory="container"
android:title="@string/action_add"/>
</menu>
mainactivity.java
package com.gap.androidgap5;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.View;
import org.apache.cordova.*;
public class MainActivity extends DroidGap{
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.init();
super.loadUrl(Config.getStartUrl());
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main, menu);
return true;
}
}
THK