Shape的属性介绍及使用
来源:互联网 发布:五星缩水软件安卓版 编辑:程序博客网 时间:2024/04/27 21:20
Shape(模型)通常用于自定义各种形状的图形,作为背景等。
shape分为 rectangle(矩形) oval(椭圆) Line(线性) ring(环形)
属性:corners(圆角)
android:radius="10dp"数值越大越圆
gradient (渐变色)
android:startColor 颜色值 起始颜色
android:endColor 颜色值 结束颜色
android:centerColor 整型 渐变中间颜色,即开始颜色与结束颜色之间的颜色
android:angle 整型 渐变角度(angle必须为45的整数倍)
android:type ["linear" | "radial" | "sweep"] 渐变类型(取值:linear、radial、sweep)
linear 线性渐变,这是默认设置
radial 放射性渐变,以开始色为中心。
sweep 扫描线式的渐变。
android:gradientRadius 整型 渐变色半径.当 android:type="radial" 时才使用。单独使用 android:type="radial"会报错。
android:centerX 整型 渐变中心X点坐标的相对位置
android:centerY 整型 渐变中心Y点坐标的相对位置
padding(内边距)
solid(填充)
size(大小)
stroke(描边)
android:width 整型 描边的宽度
android:color 颜色值 描边的颜色
android:dashWidth 整型 表示描边的样式是虚线的宽度, 值为0时,表示为实线。值大于0则为虚线。
android:dashGap 整型 表示描边为虚线时,虚线之间的间隔 即“ - - - - ” 仅当这两个属性都设置时虚线效果才生效
实例:
<Button
android:id="@+id/choose_image_btn"
android:layout_width="wrap_content"
android:layout_height="36dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="15dp"
android:background="@drawable/bg_choose_image_btn"
android:text="打开相册中的二维码"
android:textColor="@android:color/white"
android:textSize="15sp" />
bg_choose_image_btn.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 连框颜色值 -->
<item>
<shape
android:shape="rectangle">
<corners android:radius="5dp" />
<solid android:color="#FFFFFF" />
</shape>
</item>
<!-- 主体背景颜色值 -->
<item
android:bottom="1dp"
android:left="1dp"
android:right="1dp"
android:top="1dp">
<shape
android:shape="rectangle">
<corners android:radius="4dp" />
<solid android:color="#de6e6a6a" />
<padding
android:left="12dp"
android:right="12dp" />
</shape>
</item>
</layer-list>
- Shape的属性介绍及使用
- Android shape的属性介绍
- android中shape的使用介绍 1--常用属性
- Android中shape及相应属性的使用
- android shape属性的使用
- Android shape 属性介绍
- Android shape属性介绍
- Android shape属性介绍
- Android shape的属性和使用详解
- 关于android里面Shape属性的使用
- 使用shape属性在api15及api16 上出现黑背景的解决方案
- <shape> android 各属性介绍
- Android Shape属性介绍[图文]
- shape中gradient属性介绍
- shape中gradient属性介绍
- Android shape 的详解及使用
- android shape属性及使用说明
- Shape的gradient属性
- hdu 1029 Ignatius and the Princess IV
- 51Nod 1499 进制转化问题。
- 数据挖掘学习笔记-决策树算法浅析(含Java实现)
- uva11549
- C++builder调用存储过程
- Shape的属性介绍及使用
- 经典大数据架构案例:酷狗音乐的大数据平台重构
- MySQL 远程连接丢失
- java.time时间/日期API
- Hdu 2094 产生冠军
- Ubuntu 15.10安装mongodb
- delphi 如何判断编码格式,解决乱码问题
- hdu 1005 number sequence
- AsyncTask的使用