gpt4 book ai didi

android - 将底部重力设置为单个 View Android

转载 作者:行者123 更新时间:2023-11-29 15:12:45 25 4
gpt4 key购买 nike

我在显示器上有一个水平线性布局,有 3 个按钮。我希望这个布局显示在显示器的底部。

这是我写的代码:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context="flowepower.tetris.Game"
android:background="@drawable/Main_screen">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="bottom"
android:orientation="horizontal"
</LinearLayout> </RelativeLayout>

我没有放按钮代码,它们很简单。

有了这段代码,还是显示在最上面。你能建议我其他的可能性吗?谢谢你!

最佳答案

你可以试试这个:布局

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="horizontal" >

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="button1" />

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="button2" />

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="button3" />
</LinearLayout>

</RelativeLayout>

希望这就是你想要的...

关于android - 将底部重力设置为单个 View Android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28796573/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com