有没有可能我的ImageView
可以适应所有的屏幕尺寸,而不会让图像看起来被拉伸?
我尝试了所有缩放类型,并使用fill_parent
> wrap_content
将其更改为背景和源
不过,还是这样。如果图像不是更小,它看起来只是拉伸。
示例:
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:scaleType="centerInside"
android:adjustViewBounds="true"
android:background="@drawable/background" />
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:scaleType="fitXY"
android:adjustViewBounds="true"
android:background="@drawable/background" />
这两个适合宽度,但图像是拉伸的。但是,当我将其更改为src时,图像只是居中和小。
发布于 2017-12-28 17:04:25
只需向ImageView添加一个属性即可完成此操作
android:adjustViewBounds="true"
https://stackoverflow.com/questions/13925530
复制相似问题