安卓中shape的画法
来源:互联网 发布:php 统计在线人数代码 编辑:程序博客网 时间:2024/05/03 16:03
首先在res/drawable文件夹下,新建一个xml文件:
基本属性(corners、gradient渐变色、padding、size、solid、stroke描边)
<?xmlversion="1.0" encoding="utf-8"?>
<shapexmlns:android="http://schemas.android.com/apk/res/android" >
<android:shape=["rectangle"| "oval" | "line" | "ring"]
//shape的形状,默认为矩形
可以设置为矩形(rectangle)、椭圆形(oval)、线性形状(line)、环形(ring)
<corners android:radius="20dip" //定义圆角 所有圆角半径 android:topLeftRadius="dimension" //左上角的圆角半径
android:bottomRightRadius="dimension"/> //右下角的圆角半径
<solid android:color="#ff00ff"/> //solid用以指定内部填充色
<gradient android:type=["linear"| "radial" | "sweep"] //gradient用以定义渐变色
//共有3中渐变类型,线性渐变(默认)/放射渐变/扫描式渐变
android:angle="integer"
//渐变角度,必须为45的倍数,0为从左到右,90为从上到下
android:centerX="float" />
//渐变中心X的相当位置,范围为0~1
<stroke android:width="dimension" //描边的宽度
android:color="color" /> //描边的颜色
<size
android:width="50dp" //大小
android:height="50dp" /> //oval宽高相等就是圆
android:innerRadius 尺寸,内环的半径
android:thickness 尺寸,环的厚度
android:innerRadiusRatio 浮点型,以环的宽度比率来表示内环的半径
shape/>
- 安卓中shape的画法
- Android - shape圆形画法(oval)
- Android - shape圆形画法(oval)
- 安卓中shape的使用
- 数据流程图的画法
- 数据流程图的画法
- 正弦函数的画法
- WPF 虚线的画法
- VC++ 箭头的画法
- 有才人的画法
- 五角星的画法
- JfreeChart 虚线的画法
- 数据流图的画法
- 直线的画法
- 数据流图的画法
- 数据流图的画法
- ER图的画法
- MFC-箭头的画法
- PHP编程效率的20个要点
- Redux 莞式教程
- 这个是没有效果的
- node.js实战学习笔记02--扩展事件监听器实现文件监听
- 0005 控制语句
- 安卓中shape的画法
- 最大子串和
- ActivityThread解析
- 基于dubbo框架下的RPC通讯协议性能测试
- 几个applicationcontext实现类
- 第11章 样式(1)——概述、创建和使用
- Windows安装redis
- Android ExpandableListView
- docker入门