您的位置:首页 > 移动开发 > Android开发

Android 建立View 圆角

2015-09-28 13:40 369 查看
虽然很easy,不过还是录制。

混合参观


在drawable文件下 创建一个布局文件corners_bg.xml

<?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>

一般。四个圆角都是一样的,能够简单的写为:

<?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>

调用非常easy,仅仅须要在用圆角的View中:

android:background="@drawable/corners_bg"
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: