一個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"
搞定。