简体   繁体   English

将图像的中心对准屏幕底部

[英]Align the center of an image to the bottom of the screen

I was wondering what would be the easiest way to align the vertical center of an image to the bottom of the screen in android. 我想知道什么是将图像的垂直中心与android屏幕底部对齐的最简单方法。 It doesn't seem like it should be that hard, but I can't seem to find anything with an answer to this. 似乎应该没有那么难,但是我似乎找不到任何答案。

You could use a FrameLayout and position the ImageView at the Bottom center of it. 您可以使用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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM