Android中自定义TextView的样式

Android自定义TextView的样式,改变背景颜色,边框粗细和颜色,角的弧度等

 

在res/drawable文件夹下新建一个dd.xml文件,建一个shap,在里面添加需要改变的内容

<shape xmlns:android="http://schemas.android.com/apk/res/android">


    <solid android:color="#ef0909"></solid>//设置背景色

    <stroke android:width="1px" android:color="#06ef21"></stroke>//设置边框属性


</shap

在布局文件中有控件引用刚才定义的xml文件

<TextView
        android:id="@+id/te"
        android:layout_width="300px"
        android:layout_height="100px"
        android:layout_marginTop="50px"
        android:background="@drawable/dd"
        />

 

posted @ 2018-01-06 08:54  西红柿里没有番茄  阅读(420)  评论(0编辑  收藏  举报