我有這個列表視圖,其中圖像視圖不適合屏幕寬度,即使位圖的大小大於屏幕大小。下面是結果我得到:Android列表視圖圖像不適合屏幕寬度
(由於垃圾郵件的政策,我不能在這裏後我的截圖,請點擊下面的鏈接查看截圖。) http://www.sundancepost.com/ivue/screen/screen1.jpg
如圖中紅色框指示屏幕上方,該列表不適合屏幕的寬度。
以下是我想要的結果:
http://www.sundancepost.com/ivue/screen/screen2.jpg
這裏是我的佈局代碼。
featured_listrow.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:id="@+id/banner"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="@drawable/ampersand_banner"/>
</RelativeLayout>
featured_list:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ListView
android:id="@+id/android:list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:smoothScrollbar="true"
>
</ListView>
</LinearLayout>
我相信我已經正確設置layout_width和layout_height兩者的佈局文件。我認爲這與運行時設置的android:adjustViewBounds有關。有人能幫幫我嗎?
'android:scaleType =「fitXY」' –
不幸的是,結果仍然是一樣的。即使當我調整圖像大小以適合屏幕寬度時,也會發生這種情況。 –
嘗試玩scaleType的值。另外,請顯示listVIew的適配器的代碼。我不認爲xml有什麼問題。 –