将imageView中的图像与底部中心对齐 [英] Align image within imageView to bottom center
本文介绍了将imageView中的图像与底部中心对齐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个简单的imageView,我希望图像显示在底部中央.此刻它显示在右下角.
I have a simple imageView and I want an image to be displayed in the center of the bottom. At the moment it is displayed in the bottom right corner.
<ImageView
app:srcCompat="@android:drawable/simple_picture"
android:id="@+id/picture"
android:layout_centerHorizontal="true"
android:layout_height="300dp"
android:layout_width="330dp"
android:scaleType="fitEnd"/>
是否可以将scaleType用于底部和中心?
is there any way to use scaleType for bottom and center?
谢谢!
推荐答案
将父级布局添加为相对
<ImageView
android:id="@+id/picture"
android:layout_width="250dp"
android:layout_height="350dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_gravity="bottom"
app:srcCompat="@drawable/oldman1" />
这篇关于将imageView中的图像与底部中心对齐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文