gpt4 book ai didi

android - 将 RelativeLayout 置于 RelativeLayout 下方

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:21:36 28 4
gpt4 key购买 nike

RelativeLayout in Android Studio

我有一个水平的 LinearLayout,其中有一个 RelativeLayout,我希望另一个 RelativeLayout 位于其下方,同样贯穿 xml 文件,但布局出现在前一个布局的右侧

我试图将 RelativeLayout 的上边距设置为某个随机值,例如 60sp,它位于之前的 RelativeLayout 下方,但是当我添加 TextView 时,TextView 不会在设计 View 中显示

After adding textview to RelativeLayout

如何将 Layout 定位在之前的 RelativeLayout 下方?以及如何将 TextView 添加到此 RelativeLayout 并显示它们?

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/calcbackground"
android:weightSum="1">

<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="53dp"
>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="SHIFT"
android:id="@+id/shifttextiew"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="DEG"
android:id="@+id/degtextview"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/shifttextiew"
android:layout_toEndOf="@+id/shifttextiew"
android:layout_marginLeft="31dp"
android:layout_marginStart="31dp" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="RAD"
android:id="@+id/radtextview"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/degtextview"
android:layout_toEndOf="@+id/degtextview"
android:layout_marginLeft="30dp"
android:layout_marginStart="30dp" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="GRAD"
android:id="@+id/gradtextview"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/radtextview"
android:layout_toEndOf="@+id/radtextview"
android:layout_marginLeft="41dp"
android:layout_marginStart="41dp" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="12345678910"
android:id="@+id/calculationtextview"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/shifttextiew"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />

</RelativeLayout>

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="60sp">

</RelativeLayout>

</LinearLayout>

最佳答案

你告诉它在右边:android:orientation="horizo​​ntal"

让你的 LinearLayout 垂直。

关于android - 将 RelativeLayout 置于 RelativeLayout 下方,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34545852/

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