一个textview_border.xml文件放在drawable文件夹里面
- <?xml version="1.0" encoding="utf-8"?>
- <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
- <solid android:color="#ffffff" />
- <stroke android:width="1dip" android:color="#4fa5d5"/>
- </shape>
为要添加边框的TextView添加一个background
- android:background="@drawable/textview_border"
搞定。