在drawable文件下?創(chuàng)建一個(gè)布局文件corners_bg.xml
//圓角View的背景顏色
<?xml?version="1.0"?encoding="utf-8"?><shape?xmlns:android="http://schemas.android.com/apk/res/android"><solid?android:color="#000000"?/> //圓角View的背景顏色
<corners?android:topLeftRadius="10dp"?
?android:topRightRadius="10dp"? ?
android:bottomRightRadius="10dp"
android:bottomLeftRadius="10dp"/>???
?</shape>?
?一般擎析。四個(gè)圓角都是一樣的琅捏,能夠簡(jiǎn)單的寫為:
<?xml?version="1.0"?encoding="utf-8"?>
<shape?xmlns:android="http://schemas.android.com/apk/res/android">???????
?<solid?android:color="#000000"?/>???????
?<corners?android:radius="5dp"/>
?</shape>?
調(diào)用非常easy愤兵,僅僅須要在用圓角的View中:
android:background="@drawable/corners_bg"