Android 建立View 圆角

虽然很easy,不过还是录制。

混合参观Android 建立View 圆角

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

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <shape xmlns:android="http://schemas.android.com/apk/res/android">
  3. <solid android:color="#000000" /> //圆角View的背景颜色
  4. <corners android:topLeftRadius="10dp"   //上左圆角
  5. android:topRightRadius="10dp"    //上右圆角
  6. android:bottomRightRadius="10dp"
  7. android:bottomLeftRadius="10dp"/>
  8. </shape>
         一般。四个圆角都是一样的,能够简单的写为:
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <shape xmlns:android="http://schemas.android.com/apk/res/android">
  3. <solid android:color="#000000" />
  4. <corners android:radius="5dp"/>
  5. </shape>

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

  1. android:background="@drawable/corners_bg"

版权声明:本文博主原创文章。博客,未经同意不得转载。

上一篇:vs widows服务的调试


下一篇:spring boot ${}占位符不起作用