imageview适配问题

来源:互联网 发布:csd软件 编辑:程序博客网 时间:2024/06/05 04:00

图片大小适配,可考虑使用

<ImageView       android:id="@+id/goudian_image"       android:src="@drawable/goudian_pic1"        android:adjustViewBounds="true"        android:scaleType="fitXY"        android:layout_width="wrap_content"    android:layout_height="wrap_content"/>

但是上面的代码一般情况下图片显示是正常的,但是长宽比例不同也会使图片变形,只是不会出现空白区域,如果要不变形则去掉

android:scaleType="fitXY"
即可,代码使用的时候也是使用

layout_image.setImageResource(R.drawable.banner);而不使用layout_image.setBackgroundDrawable(background);

0 0