安卓:横线在中间的文本 [英] Android : horizontal line with text in middle
本文介绍了安卓:横线在中间的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道如何做到这一点的水平线,在中间的文字,看看这张截图:
I would like to know how to do this horizontal line with text in the middle, look this screenshot :
有人有一个想法,这样做在Android?我发现了如何做一个水平线上,但从未使用文本。
Someone have an idea to do that on Android ? I found how to do a horizontal line, but never with text.
谢谢!
推荐答案
只要改变颜色,以配合那些对你的形象。我也建议你使用渐变作为背景的虚拟视图,它看起来好多了,然后截图,如果你把一点点的时间到了。
Just change the colors to match the ones on your image. I also suggest you use a gradient as the background for those dummy views, it looks a whole lot better then the screenshot if you put a little time into it.
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:orientation="horizontal">
<TextView
android:id="@+id/tvText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:text="lala"
android:textColor="#FFFFFF"/>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_centerVertical="true"
android:layout_marginLeft="16dp"
android:layout_toLeftOf="@id/tvText"
android:background="#FF0000"
/>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_centerVertical="true"
android:layout_marginRight="16dp"
android:layout_toRightOf="@id/tvText"
android:background="#FF0000"
/>
</RelativeLayout>
这篇关于安卓:横线在中间的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文