如何在两个直线android之间放置文本?

Sha*_*dow 1 android textview

我需要在一条直线之间放置一个文本.我尝试使用视图,但textview位于该行下方.怎么解决这个?我的代码如下:

   <RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"

 >
<View

         android:layout_width="wrap_content"
         android:layout_height="2dp"
         android:layout_alignParentLeft="true"
         android:layout_toLeftOf="@+id/orText"
         android:background="#c0c0c0"/>
 <View
         android:layout_width="wrap_content"
         android:layout_height="2dp"
         android:background="#c0c0c0"
         android:layout_toRightOf="@+id/orText"
         android:layout_alignParentRight="true"/>

 <TextView
     android:id="@+id/orText"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:layout_alignParentTop="true"
     android:layout_centerHorizontal="true"
     android:text="OR"
     android:textColor="@android:color/black" />

 </RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

这是截图,

在此输入图像描述

Mur*_*ain 10

<RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical|center_horizontal"
        android:layout_marginTop="10dp" >

        <View
            android:layout_width="wrap_content"
            android:layout_height="2dp"
            android:layout_centerVertical="true"
            android:layout_toRightOf="@+id/orText"
            android:background="#c0c0c0" />

        <TextView
            android:id="@+id/orText"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"
            android:layout_centerHorizontal="true"
            android:text="OR"
            android:textColor="@android:color/black" />

        <View
            android:layout_width="wrap_content"
            android:layout_height="2dp"
            android:layout_centerVertical="true"
            android:layout_toLeftOf="@+id/orText"
            android:background="#c0c0c0" />
    </RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述