Android 按钮动态放置在按钮上

发布于 2024-10-07 20:07:21 字数 93 浏览 0 评论 0原文

我想知道是否有办法在屏幕底部放置一个按钮,无论设备的屏幕尺寸如何。我基本上希望按钮有一个重力=“底部”,而不仅仅是它的文本。我一直在尝试这样做,但找不到方法。有什么建议吗?

I wanted to know if there is a way to place a button on the bottom of the screen, no matter what size screen the device has. I basically want the button to have a gravity="bottom", not just its text. I have been trying to do this, and I cannot find a way to do it. any suggestions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

对不⑦ 2024-10-14 20:07:21

按钮采用什么布局?使用相对布局,您可以将按钮设置为 align_parent_bottom

What layout is the button in? Using a relative layout, you can set the button to align_parent_bottom.

攒一口袋星星 2024-10-14 20:07:21

使用带有 layout_height="fill_parent"RelativeLayout,然后在 XML 文件中将按钮的 layout_alignParentBottom 值设置为 true

use a RelativeLayout with layout_height="fill_parent" then set the button's layout_alignParentBottom value to true in the XML file

海未深 2024-10-14 20:07:21

没关系,我只是创建了一个子 LinearLayout,然后将

android:gravity="bottom"

其放入其中,它就起作用了:-)

Never mind, I created a child LinearLayout only for and I put

android:gravity="bottom"

in the child and it worked :-)

以为你会在 2024-10-14 20:07:21

尝试在按钮上使用 android:layout_gravity="bottom" :)

Try using android:layout_gravity="bottom" on the Button :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文