android背景圆角的实现
1.创建一个xml文件,命名为circle_corner,放置到drawable目录下,内容以下:
<?
xml
version
="1.0"
encoding
="utf-8"
?>
<
shape xmlns:android = "http://schemas.android.com/apk/res/android"
>
<
gradient
android:endColor
="@android:color/transparent"
android:startColor
="#000000"
android:gradientRadius
="60"
android:type
="radial"
/>
<
corners
android:radius
="10px"
/>
</
shape
>
2.在须要圆角背景的元件上设置背景为circle_corner
<
TextView
android:text
="abc"
android:background
="@drawable/circle_corner"
android:layout_width
="wrap_content"
android:layout_height
="wrap_content"
>