【发布时间】:2012-06-05 10:08:10
【问题描述】:
我有这个列表视图,其中的图像视图不适合屏幕宽度,即使位图的大小大于屏幕大小。这是我得到的结果:
(由于垃圾邮件政策,我不能在这里发布我的截图。请点击下面的链接查看截图。) 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>
精选列表:
<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 设置有关。有人可以帮帮我吗?
【问题讨论】:
-
很遗憾,结果还是一样。即使我调整图像大小以适应屏幕宽度也会发生这种情况。
-
尝试使用 scaleType 的值。另外,请显示 listVIew 的适配器代码。我不认为 xml 有什么问题。
标签: android listview android-layout imageview