我已經創建了單個項目菜單,但彈出時不顯示圖標,只顯示文本。我錯過了一個設置嗎?android菜單項不顯示圖標?
java File
package com.menu;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
public class MymenuActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu, menu);
return true;
}
}
menu.xml文件
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@+id/icon"
android:icon="@drawable/ic_launcher" />
<item android:id="@+id/text"
android:title="Text" />
<item android:id="@+id/icontext"
android:title="Icon"
android:icon="@drawable/ic_launcher" />
</menu>
請幫助
是否'ic_launcher'繪製存在於你的目標DPI繪製資源目錄? – 2012-03-07 03:27:33
你解決了這個問題嗎?具有完全相同的概率 – membersound 2012-05-17 21:21:23