gpt4 book ai didi

Android - 布局问题 - Textviews top center and bottom center

转载 作者:行者123 更新时间:2023-11-30 04:51:04 26 4
gpt4 key购买 nike

我有一个布局问题。

假设我有一个 RelativeLayout 出现在我的屏幕底部。在此,我想添加 2 个 TextView ,一个在中心,一个在顶部中心,一个在底部中心。

|--------------------------|
| Text1 |
| Text2 |
|--------------------------|

类似的东西:-)

最佳答案

这对你来说如何:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center_horizontal">
<TextView android:id="@+id/text1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Text 1"/>
<TextView android:id="@+id/text2"
android:layout_below="@id/text1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Text 2"/>
</RelativeLayout>

关于Android - 布局问题 - Textviews top center and bottom center,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3367376/

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