Android初级进阶之Shape
来源:互联网 发布:手机网络代理 编辑:程序博客网 时间:2024/05/23 00:05
shape
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle|oval|ring|line"><!--形状--> <solid /><!--背景颜色--> <corners /><!--角度,圆角--> <gradient /><!--线性变化--> <size /><!--大小--> <stroke/><!--边框--> </shape>
rectangle
圆角矩形
图片
xml
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <corners android:radius="8dp" /> <padding android:bottom="7dp" android:left="7dp" android:right="7dp" android:top="7dp" /> <solid android:color="#f60" /> </shape>
注
使用bottomLeftRadius等属性,可以做出不同的效果,如左两边圆角,右两边不圆角等。
圆角矩形-边框
图片
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <solid android:color="@color/colorPrimaryDark" /> <corners android:radius="10dp" /> <stroke android:width="10dp" android:color="#f60" /> </shape>
注
虚线:
<stroke android:width="10dp" android:dashGap="3dp"<!--虚线间隔--> android:dashWidth="13dp"<!--虚线宽度--> android:color="#f60" />
图
oval
实心圆
图片
xml
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval" android:useLevel="false" > <solid android:color="#f60" /> <size android:width="50dp" android:height="50dp" /> </shape>
实心圆-边框
图片
xml
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval" android:useLevel="false"> <solid android:color="#03a9f4" /> <size android:width="20dp" android:height="20dp" /> <stroke android:width="5dp" android:color="#f60" /> </shape>
注:
虚线等与矩形相同
ring
图片
xml
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="ring" android:useLevel="false" android:innerRadiusRatio="4" android:thicknessRatio="8"> <solid android:color="#f00" /> <size android:width="100dp" android:height="100dp" /> </shape>
0 0
- Android初级进阶之Shape
- Android初级进阶之自定义时钟(一)
- Android初级进阶之自定义时钟(二)
- android初级学习之使用shape显示圆形
- Android初级讲师进阶
- Android初级进阶之自定义View之SafeVeiw
- 初级程序员进阶之路
- 初级程序员进阶之路
- android UI 之shape
- android shape 之gradient
- android res之shape
- android之shape基础
- Android样式之Shape
- Android样式之Shape
- Android开发之shape
- iOS初级开发工程师进阶之路
- android进阶之旅,初级试水型探索(activity四种启动模式详解)
- Android进阶之路 - okHttp中Get与Post初级使用(一)
- zookeeper 伪分布式配置
- hdu1042 N!(大数)
- 大数据系列修炼-Scala课程05
- 几种排序算法比较
- 项目开发
- Android初级进阶之Shape
- javap命令生成native需要的签名
- view的onSaveInstanceState和onRestoreInstanceState
- 分享一个最近写的Scenekit 的 demo
- 【数据库+Web】代码管理系统
- MVC与MVVM
- hdu5776——sum(抽屉原理)
- 清风徐徐,荷开娉婷
- 亿级商品详情页架构演进技术解密