Android实现代码画虚线边框背景效果
作者:Andye 时间:2022-11-03 10:48:42
实现如下边框效果:
虚线画效果,可以使用Android中的xml来做。下面话不多说,直接上代码:
<RelativeLayout
android:id="@+id/coupon_popup"
android:layout_width="320dp"
android:layout_height="200dp"
android:layout_margin="20dp"
android:gravity="center_vertical"
android:background="@drawable/bg_border_stroke">
写一个 bg_border_stroke的xml做背景。
bg_border_stroke.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape>
<stroke
android:width="1dp"
android:color="#E8A227" />
<solid android:color="#FFFFFF" />
<corners android:radius="5dp" />
</shape>
</item>
<item
android:bottom="1dp"
android:left="1dp"
android:right="1dp"
android:top="1dp">
<shape>
<stroke
android:dashGap="15dp"
android:dashWidth="15dp"
android:width="2.5dp"
android:color="#E8A227" />
<solid android:color="#FFFFFF" />
<corners android:radius="5dp" />
</shape>
</item>
</layer-list>
总结
标签:android,虚线,边框
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
C#语音识别用法实例
2021-09-11 01:16:47
通过实例学习Either 树和模式匹配
2023-05-21 02:02:41
![](https://img.aspxhome.com/file/2023/1/62131_0s.gif)
不可不知的Android strings.xml那些事
2022-06-04 00:14:05
C# WinForm实现图片浏览器
2022-04-12 23:28:00
![](https://img.aspxhome.com/file/2023/6/92906_0s.jpg)
第三方包jintellitype实现Java设置全局热键
2023-09-25 10:33:50
SpringBoot使用@ResponseBody返回图片的实现
2023-11-28 04:41:24
![](https://img.aspxhome.com/file/2023/4/60414_0s.jpg)
Android Shape属性创建环形进度条
2021-08-02 09:03:08
![](https://img.aspxhome.com/file/2023/4/94274_0s.gif)
Spring Boot JPA中使用@Entity和@Table的实现
2023-11-22 11:49:58
Java Comparable和Comparator对比详解
2022-08-13 01:28:08
Java实现将每日新闻添加到自己博客中
2023-02-08 16:20:43
![](https://img.aspxhome.com/file/2023/7/62527_0s.jpg)
Java用 Rhino/Nashorn 代替第三方 JSON 转换库
2023-11-04 02:20:26
Spring boot项目使用thymeleaf模板过程详解
2022-10-20 22:30:58
java中计算字符串长度的方法及u4E00与u9FBB的认识
2022-07-15 18:28:20
Java定时任务的三种实现方法
2022-01-13 06:59:01
Android开发环境安装和配置图文教程
2023-08-04 16:58:26
![](https://img.aspxhome.com/file/2023/0/138530_0s.png)
Android 图片切换器(dp、sp、px) 的单位转换器
2022-04-25 02:48:06
![](https://img.aspxhome.com/file/2023/3/138913_0s.jpg)
C++ boost::asio编程-异步TCP详解及实例代码
2021-12-28 03:36:52
java 工厂模式的讲解及优缺点的介绍
2022-02-05 10:57:09
详解Java的回调机制
2023-07-27 07:17:43
![](https://img.aspxhome.com/file/2023/7/60657_0s.png)
聊聊java中引用数据类型有哪些
2022-01-10 11:59:10