将图像的中心与屏幕底部对齐

Align the center of an image to the bottom of the screen

我想知道在 android 中将图像的垂直中心与屏幕底部对齐的最简单方法是什么。看起来不应该那么难,但我似乎找不到任何答案。

您可以使用 FrameLayout 并将 ImageView 放在它的底部中心。

<FrameLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="center_horizontal">

    <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/imageView"
            android:layout_gravity="center_horizontal|bottom" />
</FrameLayout>