如何将 xml 图像调整到其父级的高度
How to set an xml image resizing to its parent's height
我正在做一个需要使用图像的应用程序,但是 HorizontalScrollView 上的 ImageView 没有调整到其父级的高度。怎么做?我尝试了所有方法,例如 centerCrop、ScaleType 等...但没有任何效果
<HorizontalScrollView
android:layout_width="fill_parent"
android:orientation="horizontal"
android:layout_height="@dimen/scrollShareImgHeight">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/sharedLinearLayoutImgs"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:adjustViewBounds="true"
android:src="@drawable/loremipsum"/>
</LinearLayout>
</HorizontalScrollView>
保持线性布局的高度为“match_parent”。
我正在做一个需要使用图像的应用程序,但是 HorizontalScrollView 上的 ImageView 没有调整到其父级的高度。怎么做?我尝试了所有方法,例如 centerCrop、ScaleType 等...但没有任何效果
<HorizontalScrollView
android:layout_width="fill_parent"
android:orientation="horizontal"
android:layout_height="@dimen/scrollShareImgHeight">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/sharedLinearLayoutImgs"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:adjustViewBounds="true"
android:src="@drawable/loremipsum"/>
</LinearLayout>
</HorizontalScrollView>
保持线性布局的高度为“match_parent”。