Shape自身的属性
来源:互联网 发布:淘宝天猫装修助手 编辑:程序博客网 时间:2024/05/21 17:43
Shape的属性有 rectangle、oval、line、ring:
① rectangle(矩形) :这是shape默认的形状 使用默认形状时 shape的corners、gradient、padding、size、solid、stroke子标签都有效。
代码示例:
<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <solid android:color="#ff0022"/> <corners android:radius="20dp"> </corners></shape>`
布局:
<TextView android:layout_marginTop="50dp" android:layout_width="match_parent" android:layout_height="100dp" android:textSize="20sp" android:gravity="center" android:background="@drawable/shape"/>
效果:
② oval(椭圆):
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval"> <size android:width="10dp" android:height="5dp"></size> <solid android:color="#000000"></solid></shape>
效果:
③ring(环形):
先介绍它的几个属性
android:innerRadius="50dp" -----内环半径 android:innerRadiusRatio="9" -----以环的宽度比率来表示内环的半径(这个值是在没有 android:innerRadius时起作用的) android:thickness="100dp" -----环的宽度 android:thicknessRatio="3" -----以环的宽度比率来表示环的厚度(这个值是在没有 android:thickness时起作用的) android:useLevel="false" -----这里一定要要加上useLevel属性并定义为false,不然没有效果 android:tint="#555555" -----环的颜色 android:tintMode="multiply" ----色彩模式
代码:
<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="ring" android:thickness="50dp" android:innerRadius="50dp" android:tint="#966449" android:dither="true" android:useLevel="false"></shape>
效果:
代码:
<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="ring" android:innerRadiusRatio="10" android:thicknessRatio="5" android:tint="#fee555" android:useLevel="false"></shape>
效果:
shape里面大概就是这些属性了,之后就是结合它的子标签灵活使用。
0 0
- Shape自身的属性
- H5自身的属性
- Shape的gradient属性
- android shape的属性
- android shape 的属性
- Android shape的属性
- shape的属性
- 关于shape的一些属性
- Shape的相关属性详解
- android中shape的属性
- Android中shape的属性
- shape 各属性的注解
- Android shape的属性介绍
- android shape属性的使用
- Spring-属性文件自身的引用03
- shape 属性
- Shape属性:
- Android DrawableShape资源的用法,Shape属性,Shape开发
- python导出excel常用格式样式设置
- URI、URL与URN的关系
- 中科爱讯WiFi探针TZ002使用配置方法
- 《Java Web 从入门到精通 》 第一章 DAY1
- mysql优化基本常识
- Shape自身的属性
- Linux getsockopt SO_ERROR values (errno.h)
- Handler相关笔记
- Uva133救济金发放
- Yii2.0-advanced-9—缓存配置(redis)
- gpio键盘active_low参数 的作用
- 二维码生成器
- iOS--构建版本无效
- jsp页面中插入jsp代码片段