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>

效果:


字体大小,颜色都是可以修改的哦!觉得不错同学点赞。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM