Android如何设置只有边框背景透明的背景呢?

很简单,只需要新建一个 drawable 文件

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <stroke
        android:width="1dp"
        android:color="@color/color_128EE7" />
    <corners android:radius="12.5dp" />
</shape>

效果

概念拓展

stroke 是用来处理边框的,可以修改边框粗细 和 颜色等等;
corners 可以设置边框的圆角显示,也可以只是设置某一个圆角;
android:bottomLeftRadius -> 设置左下圆角;
android:bottomRightRadius-> 设置右下圆角;
android: topLeftRadius --> 设置左上圆角;
android: topRightRadius --> 设置左下圆角;

posted @ 2020-04-22 17:20  spider008  阅读(766)  评论(0编辑  收藏  举报