1
我需要在一条直线之间放置文本。我尝试通过使用视图,但textview下线。如何解决这个问题? 我的代码如下:如何在两条直线android之间放置文本?
<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>
下面是截图,
你可以使用** 9 **补丁作为你的TextView的背景。 – 2014-12-04 12:15:43
@DerGolem +1,这实际上不仅是最简单但更有效的解决方案。 – 2014-12-04 12:17:47