Android——分割线中夹文字

内容不多,只是感觉平时很容易遇上,那就做个笔记吧!

其实很简单,如下:

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:textSize="15dp"
android:layout_marginLeft="5dip"
android:layout_marginRight="5dip"
android:text="分类"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#999" />
<TextView
android:id="@+id/textView1"
android:layout_width="150dip"
android:layout_height="1dip"
android:layout_centerVertical="true"
android:layout_toLeftOf="@id/tv"
android:background="#999" />
<TextView
android:id="@+id/textView2"
android:layout_width="150dip"
android:layout_height="1dip"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/tv"
android:background="#999" />
</RelativeLayout>

效果:


字体大小,颜色都是可以修改的哦!觉得不错同学点赞。
posted @ 2017-07-25 09:31  lusCodding  阅读(1608)  评论(1编辑  收藏  举报