开发者

Error on adding the Menu items

I am using onCreateOptionsMenu() in my activity and trying to add the menu items using menu.add().

Eg: menu.add(0,INFO,0,"Info"). Supp开发者_C百科ose i have this line in my code, i am getting error on INFO. What should be done to solve this?


I post an example for you how I'm doing it. So you have something to compare. Please tell us if you found your Problem, this question could help others then too :) If you give some of your code we can investigate your problem :)

In the activity:

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);
    getMenuInflater().inflate(R.menu.abort_menu, menu);

    return true;
}

XML in menu folder (abort_menu.xml):

<?xml version="1.0" encoding="utf-8"?>
<menu
xmlns:android="http://schemas.android.com/apk/res/android"
>
  <item
    android:id="@+id/abort_menu"
    android:title="@string/abort"
    android:enabled="true"
    android:menuCategory="alternative"
    android:titleCondensed="@string/abort"
    android:visible="true"
    android:alphabeticShortcut="@string/abort"
    android:icon="@android:drawable/ic_menu_close_clear_cancel"
 />

</menu>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜