android 用代码画虚线边框背景
1.虚线画效果,可以使用Android中的xml来做。
2.直接上代码:
<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 用代码画虚线边框背景的更多相关文章
- android 用代码画虚线边框背景(转)
1.虚线画效果,可以使用Android中的xml来做. 2.直接上代码: <RelativeLayout android:id="@+id/coupon_popup" and ...
- Android通过用代码画虚线椭圆边框背景来学习一下shape的用法
在Android程序开发中,我们经常会去用到Shape这个东西去定义各种各样的形状,shape可以绘制矩形环形以及椭圆,所以只需要用椭圆即可,在使用的时候将控件比如imageview或textview ...
- UIView画虚线边框
//fatherView加虚线边框 -(void)boundingRectangleForView:(UIView *)fatherView{ CAShapeLayer *borderLayer = ...
- android用shape画虚线,怎么也不显示
一直以为android的shape能画直线.虚线.矩形,圆形等.画直线也就算了.用一个view设一下高度和颜色,就能够出来一条直线了.所以说这个对我来说常常不用,圆形是能够,看看我应用里的消息提 ...
- android画虚线的自定义VIew
package com.yesway.ycarplus.view; import android.annotation.SuppressLint; import android.content.Con ...
- android 画虚线、实线,画圆角矩形,一半圆角
1.画虚线,实线: 建立dotted_line_gray.xml文件放在drawable文件夹下面. android:shape="line" 可以修改你想要的形状 <?xm ...
- Android 自定义android控件EditText边框背景
在我们进行Android应用界面设计和时候,为了界面风格的统一,我们需要对一些控件进行自定义.比如我们的应用采用的蓝色风格,但是 android的EditText控制获得焦点后显示的却是黄色的边框背景 ...
- CSS,点击去除虚线边框代码
- 【转】Android开发笔记——圆角和边框们
原文地址:http://blog.xianqu.org/2012/04/android-borders-and-radius-corners/ Android开发笔记——圆角和边框们 在做Androi ...
随机推荐
- mysql-5.7.18解压版启动mysql服务
1.下载mysql社区版 2.解压到D:\Program Files 3.在D:\Program Files\mysql-5.7.18-winx64\bin下,新建文件my.ini,内容如下: [cl ...
- [PowerShell Utils] Create a list of virtual machines based on configuration read from a CSV file in Hyper-V
Hello everyone, this is the third post of the series. . Background =============== In my solution, ...
- Spiral Matrix leetcode java
题目: Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spira ...
- C#基础知识整理:C#类和结构(1)
1.结构功能特性? 实现代码?结构用struct关键字定义的,与类类似,但有本质区别.结构实质是一个值类型,它不需要对分配的.结构的特性:(1).结构作为参数传递时,是值传递.(2).结构的构造函数必 ...
- WebApi&MVC对比
使用上区分,mvc主要用于建站,web api主要用于构建http服务,当然你非要用mvc来构建Uri式的Api也行,不过显然是没有这个必要的,一个不恰当的比喻就像是你也可以玩破解版的单机游戏,也可以 ...
- [Algorithm] Reservoir Sampling
Given a stream of elements too large to store in memory, pick a random element from the stream with ...
- Go语言中的RPC调用
首先,说一下目录结构: 一.HttpRPC 1.建立服务文件 /*Go RPC的函数只有符合下面的条件才能被远程访问,不然会被忽略,详细的要求如下: 函数必须是导出的(首字母大写) 必须有两个导出类型 ...
- Java 判断Windows下某个进程是否运行
public static void main(String[] args) { String keyWord = "chrome.exe"; Runtime runtime = ...
- Git客户端安装
Git介绍 分布式 : Git版本控制系统是一个分布式的系统, 是用来保存工程源代码历史状态的命令行工具; 保存点 : Git的保存点可以追踪源码中的文件, 并能得到某一个时间点上的整个工程项目额状态 ...
- Android学习笔记八:用Broadcast Receiver跨进程(跨app)通信
转载请注明原文地址:http://www.cnblogs.com/ygj0930/p/7515194.html 在前面介绍四大组件的时候提到了可以对外部事件进行过滤的Broadcast Receive ...