如何绘制<;人力资源>;在Android中与文本的中间行

如何绘制<;人力资源>;在Android中与文本的中间行,android,android-layout,Android,Android Layout,我正在尝试创建以下布局:有一条hr样式线,我知道如何制作,但我无法在上面放置文本(或),同样,创建两条中间有文本的hr线似乎不可能使用相对布局。关于如何做到这一点有什么建议吗 您可以在不使用任何拉线的情况下完成此操作 对于“或”两侧的线条,只需创建高度为1(或任意厚度)的视图,并使用所需的背景色,然后将其适当放置 尝试以下方法: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" an

我正在尝试创建以下布局:有一条hr样式线,我知道如何制作,但我无法在上面放置文本(或),同样,创建两条中间有文本的hr线似乎不可能使用相对布局。关于如何做到这一点有什么建议吗


您可以在不使用任何拉线的情况下完成此操作

对于“或”两侧的线条,只需创建高度为1(或任意厚度)的视图,并使用所需的背景色,然后将其适当放置

尝试以下方法:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:padding="5dp">

    <Button android:id="@+id/signInButton"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="30dp"
        android:layout_marginRight="30dp"
        android:background="#ff0000"
        android:textStyle="bold"
        android:textColor="#ffffff"
        android:text="SIGN IN WITH GOOGLE"/>

    <TextView android:id="@+id/or"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/signInButton"
        android:layout_centerHorizontal="true"
        android:textColor="#777777"
        android:text="OR"
        android:layout_marginTop="15dp"
        android:layout_marginLeft="5dp"
        android:layout_marginRight="5dp" />

    <View android:id="@+id/leftLine"
        android:layout_width="0dp"
        android:layout_height="1dp"
        android:background="#777777"
        android:layout_alignLeft="@id/signInButton"
        android:layout_toLeftOf="@id/or"
        android:layout_alignTop="@id/or"
        android:layout_marginTop="7dp"/>

    <View android:id="@+id/rightLine"
        android:layout_width="0dp"
        android:layout_height="1dp"
        android:background="#777777"
        android:layout_toRightOf="@id/or"
        android:layout_alignRight="@id/signInButton"
        android:layout_alignTop="@id/or"
        android:layout_marginTop="7dp"/>    

</RelativeLayout>


在居中创建
文本视图
,并在其左右两侧创建两行。应该可以使用九个补丁。这非常棒。谢谢你,迈克尔!