我有这个列表视图,其中图像视图不适合屏幕宽度,即使位图的大小大于屏幕大小。下面是结果我得到: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有什么问题。 –