TextView 样式

TextView 文字居中

1
android:gravity="center"

TextView设置背景色和边框

1.在drawable文件夹下面创建 setbar_bg.xml

1
2
3
4
5
6
7
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<!-- 背景色 -->
<solid android:color="#FFE4B5"/>
<!-- 边框色 -->
<stroke android:width="0.5dip" android:color="#81CE47" />
</shape>

2.设置TextView顺序

android:background="@drawable/setbar_bg"

字体颜色

textColor 属性