为什么当我使用下面的 menu.xml 时图标没有出现!!。请帮我。
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<group android:id="@+id/group1">
<item android:id="@+id/item1" android:title="Embelance" android:showAsAction="always|withText"
android:icon="@drawable/ic_launcher" >
<menu>
<item android:id="@+id/E_H1" android:title="To home" android:showAsAction="always|withText"
android:icon="@drawable/ic_launcher"/>
<item android:id="@+id/E_W1" android:title="To work" android:showAsAction="always|withText"
android:icon="@drawable/ic_launcher"/>
<item android:id="@+id/E_O1" android:title="To oppional" android:showAsAction="always|withText"
android:icon="@drawable/ic_launcher"/>
</menu>
</item>
<item android:id="@+id/item2" android:title="Fier" android:showAsAction="always|withText"
android:icon="@drawable/ic_launcher">
<menu>
<item android:id="@+id/F_H1" android:title="To Home" android:showAsAction="always|withText"
android:icon="@drawable/ic_launcher"/>
<item android:id="@+id/F_W1" android:title="To work" android:showAsAction="always|withText"
android:icon="@drawable/ic_launcher"/>
<item android:id="@+id/F_O1" android:title="To Optional" android:showAsAction="always|withText"
android:icon="@drawable/ic_launcher"/>
</menu>
</item>
</group>
当使用下一个属性时,它显示应用程序中存在错误。:窗口显示项目包含错误,在运行之前修复它或类似的东西。
android:icon="@android:drawable/ic_launcher"
代码是:
@Override
public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo) {
// Inflate the menu; this adds items to the action bar if it is present.
super.onCreateContextMenu(menu, v, menuInfo);
getMenuInflater().inflate(R.menu.main_context_menu, menu);
}
@Override
public boolean onContextItemSelected(MenuItem item) {
// .......
switch(item.getItemId()){
case R.id.E_H1: // ...........
break;
case...case....case...... // other cases
return super.onContextItemSelected(item);
}