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. cocos2d-x 3.0 场景切换特效汇总

    cocos2d-x 3.0中场景切换特效比較多,并且游戏开发中也常常须要用到这些特效.来使场景切换时不至于那么干巴,遂这里汇总一下,开发中使用. 场景切换用到导演类Directory,大多数用的都是替 ...

  2. .aspx 页面引用命名空间

    一.单个页面引用: <%@ Import Namespace="" %> 二.所有页面引用,Web.config配置如下: <system.web> < ...

  3. 编写批处理命令来执行JAVA文件

    http://baobeituping.iteye.com/blog/802543 1. JAVA工程路径结构 Project    ------lib    ------src    ------W ...

  4. Android下Fragment使用(全集)

    1 http://blog.csdn.net/niu_gao/article/details/7163263  思路清晰,讲解详细,代码偏少,推荐高手阅读 2 http://blog.csdn.net ...

  5. Hibernate学习之单向一对多映射

    © 版权声明:本文为博主原创文章,转载请注明出处 说明:该实例是通过映射文件和注解两种方式实现的.可根据自己的需要选择合适的方式 实例: 1.项目结构 2.pom.xml <project xm ...

  6. jsp页面JSTL标签 <c:fn:>

    函数名 函数说明 使用举例 fn:contains 判断字符串是否包含另外一个字符串 <c:if test="${fn:contains(name, searchString)}&qu ...

  7. YUV420视频上面添加字幕

    1.source_codemain.c中实现了函数draw_Font_Func(),这个函数可以直接移植到C程序中使用.zimo.h里面放的是字模转码后的数据. 2.data_yuv测试用的yuv42 ...

  8. hdu 4112 Break the Chocolate(乱搞题)

    题意:要把一块n*m*k的巧克力分成1*1*1的单元,有两种操作方式:1,用手掰(假设力量无穷大),每次拿起一块,掰成两块小的:2,用刀切(假设刀无限长),可以把多块摆在一起,同时切开.问两种方式各需 ...

  9. nexus5刷机

    1.下载需要的刷机包,hammerhead-mra58k-factory-52364034.tgz 2.解压包到某个文件下,如D:\Download 3.重启手机进入fastboot模式下,也叫boo ...

  10. mybatis 单一参数时的动态语句

    public void getBookList(String publisher,String author){ Map<String,Object> maps = new HashMap ...