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 res之shape的更多相关文章

  1. Android系列:res之shape制作

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

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

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

  3. Android背景渐变色(shape,gradient)

    Android设置背景色可以通过在res/drawable里定义一个xml,如下: <?xml version="1.0" encoding="utf-8" ...

  4. android 开发:shape和selector和layer-list的(详细说明)

    目录(?)[+] Shape 简介 使用的方法 属性 Selector 简介 使用的方法 layer-list 简介 例子 最后   <shape>和<selector>在An ...

  5. Android中的Shape使用总结

    参考:http://www.cnblogs.com/gzggyy/archive/2013/05/17/3083218.html 在Android程序开发中,我们经常会去用到Shape这个东西去定义各 ...

  6. Android 虚线分割Shape

    <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http: ...

  7. Android中使用shape实现EditText圆角

    之前看到手机上的百度editText控件是圆角的就尝试做了一下,看了看相关的文章. 因为代码少,看看就知道了.所以下面我就直接贴上代码供大家参考,有其他的好方法记得分享哦~ 整个代码不涉及JAVA代码 ...

  8. Android自定义drawable(Shape)详解

    在Android开发过程中,经常需要改变控件的默认样式, 那么通常会使用多个图片来解决.不过这种方式可能需要多个图片,比如一个按钮,需要点击时的式样图片,默认的式样图片. 这样就容易使apk变大. 那 ...

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

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

随机推荐

  1. Solved: XXX esx.problem.hyperthreading.unmitigated.formatOnHost not found XXX

    esxi 出现XXX esx.problem.hyperthreading.unmitigated.formatOnHost not found XXX 问题. 回避方法: 将高级设置-->Us ...

  2. How to: Compile Linux kernel 2.6

      Compiling custom kernel has its own advantages and disadvantages. However, new Linux user / admin ...

  3. 最终章·MySQL从入门到高可用架构报错解决

    1. 报错原因:MySQL的socket文件目录不存在. 解决方法:创建MySQL的socket文件目录 mkdir /application/mysql-5.6.38/tmp 2. 报错原因:soc ...

  4. Python爬虫解析htm时lxml的HtmlElement对象获取和设置inner html方法

    Python的lxml是一个相当强悍的解析html.XML的模块,最新版本支持的python版本从2.6到3.6,是写爬虫的必备利器.它基于C语言库libxml2 和 libxslt,进行了Pytho ...

  5. IPC之mq_sysctl.c源码解读

    // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (C) 2007 IBM Corporation * * Author: Cedric ...

  6. 平衡搜索树-B树。

    B Tree 系列 摘录: https://blog.csdn.net/v_JULY_v/article/details/6530142 B+树介绍 B+树的几点介绍 动态查找树有: 二叉查找树,自平 ...

  7. 《Python基础教程》第一章:基础知识

    如果希望只执行普通的除法,可以在程序前加上以下语句:from __future__ import division.还有另外一个方法,如果通过命令行运行Python, 可以使用命令开关-Qnew.此时 ...

  8. Struts2标签:s:password 修改时密码为空的问题

    s:password 有个属性showPassword默认为false,想要密码显示,设置标签属性 showPassword="true" 即可.

  9. inclusion_tag模块

    目录 inclusion_tag模块 inclusion_tag模块 1.当页面上某一块区域的内容需要在多个页面上展示的使用,并且该区域的内容需要通过传参数才能正常显示,那么我们可以优先考虑inclu ...

  10. puppet完全攻略(二)让puppet代码支持vim高亮显示

    puppet完全攻略(二)让puppet代码支持vim高亮显示 2012-06-10 13:33:01 标签:puppet viong puppet完全攻略 原创作品,允许转载,转载时请务必以超链接形 ...