如何在relativeLayout下面的按钮下面显示textview

use*_*121 1 android button textview relativelayout

在下面的xml布局中,我有两个按钮位于相同位置,他们将根据visibilty设置执行其功能.现在我试图在按钮下方放置两个文本视图,我希望文本视图位于两个按钮下面,所以我使用了

android:layout_below="@id/actConnect2_btn_connect"
Run Code Online (Sandbox Code Playgroud)

但在运行时,当连接按钮可见时,文本视图将显示在其下方,如果对按钮可见,则它会重叠

如何在两个按钮下方显示textview?

注意:我知道我可以使用android:layout:marginTop但我想在没有它的情况下解决它

代码:

<Button
    android:id="@+id/actConnect2_btn_pair"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/actConnect2_tv_label_devClass"
    android:layout_centerInParent="true"
    android:text="@string/str_pair"/>

<Button
    android:id="@+id/actConnect2_btn_connect"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="@string/str_connect"
    android:layout_below="@+id/actConnect2_tv_label_devClass"
    android:layout_alignParentStart="true" />

<TextView
    android:id="@+id/actConnect2_tv_label_uuids"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@id/actConnect2_btn_connect"
    android:text="Service's UUID: ">
</TextView>

<TextView
    android:id="@+id/actConnect2_tv_uuids"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@id/actConnect2_tv_label_uuids">
</TextView>
Run Code Online (Sandbox Code Playgroud)

小智 6

将两个按钮放在LinearLayout中,然后将textview放在LinearLayout下面