详解Android TextView设置背景色与边框的方法

Android开发中,我们需要向textView添加一个边框,但textView本身不支持边框,本文是中国E盟技术频道小编整理的详解Android TextView设置背景色与边框的方法,一起来了解一下吧!

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


<?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"

本次关于详解Android TextView设置背景色与边框的方法,就到这儿了,想获得更多相关资讯的网友们,可以继续关注中国E盟技术频道哦!