xml控件配置属性

android:background="@drawable/shape"

标签

  • corners ----------圆角
  • gradient ----------渐变
  • padding ----------内容离边界距离
  • size ------------大小 
  • solid  ----------填充颜色
  • stroke ----------描边

注意的是corners的属性bottomLeftRadius为右下角、bottomRightRadius为左下角

shape制作圆角

<Button
android:layout_width="160dp"
android:layout_height="wrap_content"
android:background="@drawable/button_shape"
android:text="圆角按钮"
/>

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="#fff"/>
<padding android:top="10px" android:bottom="10px"/>
<corners android:radius="16px"/>
<stroke android:width="1px" android:color="#000"/>
</shape>

shape制作虚线

没有dashGap属性则为实线


<View
android:layout_width="match_parent"
android:layout_height="5px"
android:layout_marginTop="10dp"
android:background="@drawable/line_shape"
/>

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line" >
<stroke
android:dashGap="3dp"
android:dashWidth="8dp"
android:width="1dp"
android:color="#63a219" />
<size android:height="1dp" />
</shape>

shape制作渐变


<View
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="10dp"
android:background="@drawable/gra_shape"
/>

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" > <gradient
android:angle="270.0"
android:endColor="#ffffff"
android:startColor="#000000" /> </shape>

Android shape制作圆角、虚线、渐变的更多相关文章

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

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

  2. android:shape

    android:shape=["rectangle" | "oval" | "line" | "ring"] shape ...

  3. Android shape自定义形状,设置渐变色

      <?xml version="1.0" encoding="utf-8"?> <!-- android:shape=["rect ...

  4. 44.Android之Shape设置虚线、圆角和渐变学习

    Shape在Android中设定各种形状,今天记录下,由于比较简单直接贴代码. Shape子属性简单说明一下:  gradient -- 对应颜色渐变. startcolor.endcolor就不多说 ...

  5. Android GradientDrawable(shape标签定义) 静态使用和动态使用(圆角,渐变实现)

    Android GradientDrawable使用优势: 1. 快速实现一些基本图形(线,矩形,圆,椭圆,圆环) 2. 快速实现一些圆角,渐变,阴影等效果 3. 代替图片设置为View的背景 4. ...

  6. Android shape 渐变!描边!圆角!示例详解

    看看shape的用法,确实很有帮助.这里我偷懒转一篇比较详细的帖子,和大家一起进步~! Android 中常常使用shape来定义控件的一些显示属性,今天看了一些shape的使用,对shape有了大体 ...

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

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

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

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

  9. Android系列:res之shape制作

    大家好,pls call me francis. nice to me you. 本文将介绍使用在Android中使用shape标签绘制drawable资源图片. 下面的代码是shap标签的基本使用情 ...

随机推荐

  1. 10分钟-jQuery-基础选择器

    1.id 选择器 jquery能使用CSS选择器来操作网页中的标签元素.假设你想要通过一个id号去查找一个元素,就能够使用例如以下格式的选择器: $("#my_id") 当中#my ...

  2. 【BIEE】05_启动BIEE时,无法启动BI_SERVER

    本地修改资料库后,重新启动BIEE,结果报错: 点击[查看日志信息]后 从这里是没看出是什么问题造成的,那么我们就要去查询启动日志了 问题解决 找到日志路径:D:\obiee\instances\in ...

  3. 【VBA】设置Excle最近使用文件清单数量

    打开Excle,点击"文件"------"最近使用的文件",如下图: 根据上图可以看到,最近使用的文件数目为11个,那么是怎么实现的呢?具体代码如下: Publ ...

  4. Vue-cli + Express 构建的SPA Blog(前后分离)

    代码地址如下:http://www.demodashi.com/demo/12526.html 为什么学习并使用Vue 1.发展趋势 最近这几年的前端圈子,由于戏台一般精彩纷呈,从 MVC 到 MVV ...

  5. 快速接入 Android BLE 开发的基础框架

    代码地址如下:http://www.demodashi.com/demo/12092.html ** Android BLE基础操作框架,基于回调,操作简单.包含扫描.多连接.广播包解析.服务读写及通 ...

  6. TRIZ系列-创新原理-23-反馈原理

     反馈原理的详细表述例如以下:1)引入反馈:2)假设已经有反馈,那么改变它这个原理告诉我们应当从系统中尽量多收集反馈信息.并用这些信息来矫正系统的作用.非常easy看出,引入反馈是系统自己主动控制 ...

  7. Redis, Memcache, Mysql差别

    在使用Redis过程中,我们发现了不少Redis不同于Memcached.也不同于MySQL的特征. (本文主要讨论Redis未启用VM支持情况) 1. Schema MySQL: 需事先设计 Mem ...

  8. unity3d WebPlayer版本号音效无声音问题

    unity web player,其是一款浏览器执行unity3d游戏引擎公布的游戏的插件,和Flash Player非常像,安全无毒应该是你玩某款网页游戏安装的.假设以后不玩了就能够卸载 Unity ...

  9. Xampp 环境问题集合

    1.不小心把虚拟机的环境删了,需要重新安装xmapp 安装很简单,但是重启:/opt/lampp/lampp restart 发现 XAMPP:"Another web server dae ...

  10. 五分钟上手Git

    团队开发中.遵循一个合理.清晰的Git使用流程.是非常重要的.否则,每一个人都提交一堆杂乱无章的commit,项目非常快就会变得难以协调和维护.以下是ThoughtBot 的Git使用规范流程.我从中 ...