3
使用PhoneGap
时按下菜单按钮时,android本机菜单未打开。当我按menu
按钮时,onCreateOptionsMenu()
方法正在调用,但菜单未创建。PhonePhone中未显示原生android菜单
public class PhoneGapActivity extends DroidGap {
@Override
public void onCreate(Bundle savedInstanceState) {
super.setBooleanProperty("showTitle", true);
super.onCreate(savedInstanceState);
super.loadUrl("file:///android_asset/www/index.html");
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
super.onCreateOptionsMenu(menu);
Log.d("Menu","Menu option called");
getMenuInflater().inflate(R.menu.phone_gap, menu);
return true;
}
}
日志正在打印,这意味着函数被调用。
用于菜单的XML文件:当android:showAsAction
设置为always
它显示在操作栏中,否则它不工作。
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/action_settings"
android:icon="@drawable/ic_menu_settings_holo_light"
android:showAsAction="always"
android:title="@string/action_settings"/>
<item
android:id="@+id/more"
android:icon="@drawable/ic_menu_moreoverflow_normal_holo_light"
android:showAsAction="never"
android:title="@string/more"/>
</menu>
可能是什么问题?
这将在PhoneGap 2.8中修复 - 请参阅https://groups.google.com/forum/?fromgroups=#!topic/phonegap/niJG55vtLCs。 – phenry