【发布时间】:2014-11-16 06:04:49
【问题描述】:
我正在尝试通过保持纵横比来调整图像大小。它应该足够大以填满屏幕宽度,并且如果需要,一些图像应该在屏幕外。
here is a picture of what I want
我试过了
android:adjustViewBounds
但是当图像大于屏幕时,它会将图像放入 imageView 而不会填充宽度。
我也不想用:
android:scaleType="centerCrop"
这是我的完整代码:
<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/imageBackgroundAboutFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="fitXY"
android:adjustViewBounds="true"
android:src="@drawable/about_us_background"/>
</RelativeLayout>
【问题讨论】:
标签: android imageview aspect-ratio adjustviewbounds