
1.概要:
ShapeDrawable是一个为UI控件添加特效的好工具。这个技巧适用于那些可以添加背景的控件
2.添加圆角边框其实就是添加的背景那里不是直接添加图片,而是添加一个XML文件即可
3.用到的知识可以参考这里:http://www.cnblogs.com/liangstudyhome/p/3715259.html
在res/drawable文件夹中定义xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="#FF00FF"/>
<corners android:radius="15dp"/>
</shape>
4.直接用这个XML
<Button
android:id="@+id/btn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/hello_world"
android:background="@drawable/button_round_background"
/>
效果在上面的链接当中就有