1、画虚线,实线:

建立dotted_line_gray.xml文件放在drawable文件夹下面。

android:shape="line" 可以修改你想要的形状

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line">
<!-- 显示一条虚线,破折线的宽度为dashWith,破折线之间的空隙的宽度为dashGap,当dashGap=0dp时,为实线 -->
<stroke android:width="1dp" android:color="#D5D5D5"
android:dashWidth="2dp" android:dashGap="3dp" />
<!-- 虚线的高度 -->
<size android:height="2dp" />
</shape>

然后在布局的xml里面:
作为ImageView或者Linearlayout等作为背景源就可以了。
<LinearLayout
android:id="@+id/activity_line"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dip"
android:layout_marginRight="5dip"
android:background="@drawable/dotted_line_gray" />
---------

2、画圆角矩形

建立 rect_gray.xml文件放在drawable文件夹下面。

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- 填充颜色 -->
<solid android:color="#FFFFFF"></solid>

<!-- 线的宽度,颜色灰色 -->
<stroke android:width="1dp" android:color="#D5D5D5"></stroke>

<!-- 矩形的圆角半径 -->
<corners android:radius="0dp" />

</shape>
然后在布局的xml里面:
作为ImageView或者Linearlayout等作为背景源就可以了。
<LinearLayout
android:id="@+id/activity_myhezu_wantchuzu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/myhezu_dottedline_rect_green"
android:orientation="horizontal" >

3、一半圆角:

<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:topLeftRadius="16dp" <!--上面左圆角的半径-->
android:topRightRadius="16dp" <!--上面右圆角的半径-->
android:bottomLeftRadius="0dp" <!--下面左圆角的半径-->
android:bottomRightRadius="0dp"/> <!--下面右圆角的半径-->

<gradient android:startColor="#ffffff"
android:endColor="#ffffff"
android:angle="270"/>

<stroke android:width="1dp"
android:color="#80000000" />
</shape>

android 画虚线、实线,画圆角矩形,一半圆角的更多相关文章

  1. android画虚线的自定义VIew

    package com.yesway.ycarplus.view; import android.annotation.SuppressLint; import android.content.Con ...

  2. android 画虚线,虚线圆

    Paint paint = new Paint(); paint.setAntiAlias(true); paint.setStyle(Paint.Style.STROKE);   paint.set ...

  3. Android:res之shape制作圆角、虚线、渐变

    xml控件配置属性 android:background="@drawable/shape" 标签 corners ----------圆角gradient ----------渐 ...

  4. 【转】Android设置虚线、圆角、渐变

      Android虚线圆角渐变 有图又真相,先上图再说. 点击效果: 设置虚线: <?xml version="1.0" encoding="utf-8" ...

  5. Android设置虚线、圆角、渐变

    有图又真相,先上图再说. 点击效果: 设置虚线: <?xml version="1.0" encoding="utf-8"?> <shape  ...

  6. Android Xfermode 实战 实现圆形、圆角图片

    转载请标明出处:http://blog.csdn.net/lmj623565791/article/details/42094215,本文出自:[张鸿洋的博客] 1.概述 其实这篇本来准备Androi ...

  7. 学习笔记48—PS画虚线

    PS画虚线步骤: 1)我们打开PS后,随便新建一个文件. 2)大小随意. 2)我们选择画笔工具,快捷键是B. 3)画笔面板的快捷键是F5. 4)点击画笔预设面板,再点击右边右上角的下三角,在弹出的菜单 ...

  8. iOS 画虚线

    UIImageView *imageView1 = [[UIImageView alloc]initWithFrame:CGRectMake(, , , )]; [self.view addSubvi ...

  9. HTML5 Canvas 画虚线组件

    前段时间由于项目需要,用到了HTML5 Canvas画图,但是没有画虚线的方法,自己写了一个HTML5 画虚线的组件. dashedLine.js if (window.CanvasRendering ...

随机推荐

  1. 学习js回调函数

    <!DOCTYPE HTML> <html> <head> <meta charset="GBK" /> <title> ...

  2. UVA 10054 the necklace 欧拉回路

    有n个珠子,每颗珠子有左右两边两种颜色,颜色有1~50种,问你能不能把这些珠子按照相接的地方颜色相同串成一个环. 可以认为有50个点,用n条边它们相连,问你能不能找出包含所有边的欧拉回路 首先判断是否 ...

  3. windows下jenkins常见问题填坑

    没有什么高深的东西,1 2天的时间大多数人都能自己摸索出来,这里将自己遇到过的问题分享出来避免其他同学再一次挖坑. 目录 1. 主从节点 2. Nuget自动包还原 3. powershell部署 4 ...

  4. python常用小模块使用汇总

    在写代码过程中常用到一些好用的小模块,现整理汇总一下: 1.获取当前的文件名和目录名,并添到系统环境变量中. file = os.path.abspath(__file__)             ...

  5. 捷波朗 jabra BT3030 蓝牙耳机

    蓝牙版本V2.0 通话时间 8小时 按键说明:轻敲 快按轻敲两下 在1.5秒内快速按两下按 大约 1秒钟按住 大约 4秒钟 充电提示绿灯闪亮 正在充电持续绿灯 已完全充满电 检查电量按 音量上调(+) ...

  6. Clouda聊天室实践

    1.Clouda说明 Clouda是简单,可依赖的实时Javascript框架.对一个想开发移动webapp的开发者来说,可以使用clouda开发框架,实现一个功能和体验与native app齐平的轻 ...

  7. mysql基础安全

  8. ML-线性回归

    记样本数目为$m$,样本点$i$用$(x^{(i)}, y^{(i)})$表示,其中 $x^{(i)}=\begin{pmatrix}x_1^{(i)}\\ x_2^{(i)}\\ ...\\x_n^ ...

  9. EF常用命令行

    启用迁移:指定迁移的目录和数据库上下文名称Enable-Migrations -MigrationsDirectory "MigrationsHis" -ContextTypeNa ...

  10. Overload和Override的区别

    Overload:重载 |- 在一个类中定义的若干方法 |- 所有的方法名相同,但参数类型或个数不同 |- 只有参数有关,与返回类型无关 Override:覆写 |- 在继承的关系中 |- 子类定义了 ...