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>

相关文章:

http://blog.csdn.net/huiwolf2008/article/details/8028615

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

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

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

  2. Android res之shape

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

  3. Android系列:res之shape制作

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

  4. Android中使用shape制作一个旋转的progressbar

    public class ZNtestResActivity extends Activity { @Override public void onCreate(Bundle savedInstanc ...

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

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

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

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

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

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

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

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

  9. Android代码绘制虚线、圆角、渐变效果图

    drawable文件夹放置动画/形状/选择器等属性文件,唯一的drawable文件名,不允许写错和拼错,否则运行报错.drawable文件夹底下的xml文件可以包括的标签共18个:animation- ...

随机推荐

  1. Delphi操作Excel大全

    Delphi操作Excel大全 DELPHI操作excel(转)(一) 使用动态创建的方法 首先创建 Excel 对象,使用ComObj:var ExcelApp: Variant;ExcelApp ...

  2. Application.AddMessageFilter(this);

    开发环境:windows 8(x64), vs2013 只要“项目属性-调试”中选中“启用Visual Studio承载进程“,在VS2013中用F5调试,调用Application.AddMessa ...

  3. Mathematics:DNA Sorting(POJ 1007)

    DNA排序 题目大意:给定多个ACGT序列,按照字母顺序算出逆序数,按逆序数从小到大排列 这题其实很简单,我们只要用一个归并排序算逆序数,然后快排就可以了(插入排序也可以,数据量不大),但是要注意的是 ...

  4. win7,ubuntu双系统——重装win7后如何恢复ubuntu引导

    磁盘分区——windows 7自带分区工具实现 磁盘分区——PQ硬盘分区魔术师 win7,ubuntu双系统的安装——正式安装 win7,ubuntu双系统的安装——卸载ubuntu 讲述了我的  w ...

  5. 【leetcode】Remove Element (easy)

    Given an array and a value, remove all instances of that value in place and return the new length. T ...

  6. 【C语言】结构体

    不能定义 struct Node { struct Node a; int b; } 这样的结构,因为为了建立Node 需要 建立一个新的Node a, 可为了建立Node a, 还需要再建立Node ...

  7. java jsp调用shell(带参数)脚本并返回值

    test.jsp <%@ page language="java" import="java.util.List,java.util.ArrayList,java. ...

  8. Java常用工具类题库

    一.    填空题 在Java中每个Java基本类型在java.lang包中都在一个相应的包装类,把基本类型数据转换为对象,其中包装类Integer是___Number__的直接子类. 包装类Inte ...

  9. C#中的变量及命名规则

    变量: 1.作用 :可以让我们在计算机中存储数据 2.语法:变量类型    变量名=赋值: 3.常用的数据类型:  int   整数类型  取值范围:最大2147483647;最小-214748364 ...

  10. ios 弹出键盘 视图向上平移

    [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(keyboardwillAppear:) name:U ...