2012-12-19 27 views
0

我正在使用具有固定尺寸的ImageView將圖標添加到菜單。在我的應用程序中,我使用了很多次,但在此ImageView上,佈局參數似乎不起作用。 不像其他ImageViews,在這種情況下,我直接使用模板,但我認爲這不是問題。ImageView不重新調整圖像至所選尺寸

<?xml version="1.0" encoding="utf-8"?> 
<ImageView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="1dp" 
    android:layout_height="1dp" 
    android:scaleType="fitCenter" 
    android:src="@drawable/ic_menu_moreoverflow_normal_holo_dark" 
    android:contentDescription="ICON" /> 

它被用在代碼如下。

ImageView iview =(ImageView) View.inflate(context, R.layout.icon, null); 

從理論上講,它應該會自動調整圖像大小,但是,圖像將繼續與原來的尺寸,雖然尺寸爲1dp。哪裏有問題?非常感謝!

enter image description here

+0

檢查答案︰http://stackoverflow.com/a/3126959/466938 – Ohmnibus

回答

0
android:scaleType="fitCenter" 

你應該將其刪除。

+0

它既不工作,無論如何。 – jramirez

0

將資源的ImageView分配從src更改爲背景。