我有一个ImageView,其高度和宽度设置为"fill_parent",相对布局具有相同的值set.Set Image scaleType ="fitXY"
这里是XML布局:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/imageView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="fitXY"
android:src="@drawable/background_image" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
适合宽度和高度,但图像被拉伸.
这两个属性为我解决了问题:
android:scaleType="fitXY"
android:adjustViewBounds="true"
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
17240 次 |
最近记录: |