本地Android菜单在Phonegap中未显示

3
使用PhoneGap时,按下菜单按钮时,Android本地菜单不会打开。当我按下menu按钮时,将调用onCreateOptionsMenu()方法,但菜单没有被创建。请注意保留HTML标记。
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>
可能存在的问题是什么?
1个回答

阿里云服务器只需要99元/年,新老用户同享,点击查看详情
3

问题已解决。这个 bug 在 PhoneGap 2.6 中。我下载了 PhoneGap 版本 2.5,正常运行。


这个问题将在PhoneGap 2.8中得到解决-请参见https://groups.google.com/forum/?fromgroups=#!topic/phonegap/niJG55vtLCs。 - phenry

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,