Android res之shape
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的更多相关文章
- Android系列:res之shape制作
大家好,pls call me francis. nice to me you. 本文将介绍使用在Android中使用shape标签绘制drawable资源图片. 下面的代码是shap标签的基本使用情 ...
- Android:res之shape制作圆角、虚线、渐变
xml控件配置属性 android:background="@drawable/shape" 标签 corners ----------圆角gradient ----------渐 ...
- Android背景渐变色(shape,gradient)
Android设置背景色可以通过在res/drawable里定义一个xml,如下: <?xml version="1.0" encoding="utf-8" ...
- android 开发:shape和selector和layer-list的(详细说明)
目录(?)[+] Shape 简介 使用的方法 属性 Selector 简介 使用的方法 layer-list 简介 例子 最后 <shape>和<selector>在An ...
- Android中的Shape使用总结
参考:http://www.cnblogs.com/gzggyy/archive/2013/05/17/3083218.html 在Android程序开发中,我们经常会去用到Shape这个东西去定义各 ...
- Android 虚线分割Shape
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http: ...
- Android中使用shape实现EditText圆角
之前看到手机上的百度editText控件是圆角的就尝试做了一下,看了看相关的文章. 因为代码少,看看就知道了.所以下面我就直接贴上代码供大家参考,有其他的好方法记得分享哦~ 整个代码不涉及JAVA代码 ...
- Android自定义drawable(Shape)详解
在Android开发过程中,经常需要改变控件的默认样式, 那么通常会使用多个图片来解决.不过这种方式可能需要多个图片,比如一个按钮,需要点击时的式样图片,默认的式样图片. 这样就容易使apk变大. 那 ...
- Android中使用shape制作一个旋转的progressbar
public class ZNtestResActivity extends Activity { @Override public void onCreate(Bundle savedInstanc ...
随机推荐
- yii2 response多次输出问题的查找
{ "IsSuccess": 1, "ErrMsg": "OK", "Data": { "IsSuccess& ...
- linux命令详解——sar
Linux统计/监控工具SAR详细介绍:要判断一个系统瓶颈问题,有时需要几个 sar 命令选项结合起来使用,例如:怀疑CPU存在瓶颈,可用 sar -u 和 sar -q deng 等来查看 怀疑内存 ...
- 微信小程序开发(二)创建一个小程序页面
为了方便讲解,我们将上篇博客创建的小程序除了project.config.json和sitemap.json两个文件保留,其他全部删除(这两个文件存的是小程序的创建信息,删掉会有报错提示). 接下来我 ...
- linux基础—课堂随笔07_磁盘存储和文件系统
磁盘管理 管理分区 列出块设备 lsblk parted命令 高级分区操作 用法: parted [选项]... [设备 [命令 [参数]...]...] parted /dev/sdb mkl ...
- Django REST Framework(DRF)_第四篇
DRF分页(总共三种) PageNumberPagination(指定第n页,每页显示n条数据) 说明 既然要用人家的那么我们就先来看下源码,这个分页类源码中举例通过参数指定第几页和每页显示的数据:h ...
- python3.6 错误: ModuleNotFoundError:No module named "Crypto"
原因及处理:在使用python是经常会用到import一个第三方库,但是有时候会提示某个模块不存在,如Crypto其实是因为Python3里面这个模块的名字变了, pip install pycryp ...
- 5.Dropout
import numpy as np from keras.datasets import mnist from keras.utils import np_utils from keras.mode ...
- err:LIBUSB_SUCCESS / LIBUSB_TRANSFER_COMPLE
err:LIBUSB_SUCCESS / LIBUSB_TRANSFER_COMPLE err:LIBUSB_SUCCESS / LIBUSB_TRANSFER_COMPLE err:LIBUSB_S ...
- thymeleaf错误 org.xml.sax.SAXParseException: 在实体引用中, 实体名称必须紧跟在 ‘&’ 后面
在thymeleaf的js中使用&,<,>等符号时会产生这种问题,因为thymeleaf是采用xml解析的方式进行替换的,所以javascript中&这样的xml实体转义字 ...
- POI读取Excel如何判断行为空
public static boolean isRowEmpty(Row row) { for (int c = row.getFirstCellNum(); c < row.getLastCe ...