因此,我从Web服务加载图像,但图像的大小有时比其他图像的大小要小,并且可视化看起来很愚蠢我把它们放在Android的ListView中。我想修复ImageView的大小,使其只显示图像的一部分,如果它大于预设的数量。我尝试了所有我能想到的设置setMaxWidth/setMaxHeight,将缩放类型设置为centerCrop,使用ClipableDrawable封装我的BitmapDrawable,使用Drawable.setBounds()进行设置。我试着用XML和编程方式设置,但都没有成功。我很惊讶设置最大宽度/高度没有做任何事情。以下是我在布局文件中使用ImageView定义的XML:无论位图的大小如何使我的ImageView成为固定大小
<ImageView android:id="@+id/recipeImage"
android:maxHeight="64px"
android:maxWidth="64px"
android:scaleType="centerCrop"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:layout_marginRight="6dip"/>
没有任何工作。 Oooooouweee什么与dat? :-)
我可以发誓我试过了。谢谢你的帮助。 – chubbsondubs 2010-09-27 13:24:41
'minHeight'和'minWidth'如何? – 2016-09-13 22:39:24