开发者

Forcing a button to stay at the bottom of a phone screen

开发者 https://www.devze.com 2023-01-26 08:31 出处:网络
I have a layout that has a button I would like to always be on the bottom of the scree of my phone.The problem is android:layout_gravity=\"bottom\" only puts it at the开发者_运维知识库 below the rest

I have a layout that has a button I would like to always be on the bottom of the scree of my phone. The problem is android:layout_gravity="bottom" only puts it at the开发者_运维知识库 below the rest of the layout, rather than the very bottom of the screen. Is there a way around this?


Yeah, there is a simple solution: Use a RelativeLayout and then use the android:layout_alignParentBottom="true" attribute to place your button at the bottom of your screen. You will also have to use match_parent for both width and height of your layout. :-)

0

精彩评论

暂无评论...
验证码 换一张
取 消