为TextView加边框,需要在drawable建xml文件,里面设置shape来设置文本框的特殊效果。
效果一:
基本上常用的就这几种,要达到很好的效果,需要细致地调整。
下面是要在用到这个shape的TextView设置背景即可。
Android:background="@drawable/border_write"
效果。
效果二:
drawable文件如下:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="3dp"
/>
<padding
android:bottom="@dimen/x8"
android:left="@dimen/x8"
android:right="@dimen/x8"
android:top="@dimen/x8" />
<stroke
android:width="@dimen/x3"
android:color="#edc831"
/>
</shape>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="3dp"
/>
<padding
android:bottom="@dimen/x8"
android:left="@dimen/x8"
android:right="@dimen/x8"
android:top="@dimen/x8" />
<stroke
android:width="@dimen/x3"
android:color="#edc831"
/>
</shape>