设为首页 加入收藏

TOP

Android开发教程:shape和selector的结合使用
2014-11-24 14:46:26 来源: 作者: 【 】 浏览:15
Tags:Android 开发 教程 shape selector 结合 使用

简介


作用:XML中定义的几何形状


位置:res/drawable/文件的名称.xml


使用的方法:


Java代码中:R.drawable.文件的名称


XML中:android:background="@drawable/文件的名称"


属性:


android:shape=["rectangle" | "oval" | "line" | "ring"]


其中rectagle矩形,oval椭圆,line水平直线,ring环形


中子节点的常用属性:


渐变

android:startColor 起始颜色


android:endColor 结束颜色


android:angle 渐变角度,0从上到下,90表示从左到右,数值为45的整数倍默认为0;


android:type 渐变的样式 liner线性渐变 radial环形渐变 sweep


填充


android:color 填充的颜色


描边


android:width 描边的宽度


android:color 描边的颜色


android:dashWidth 表示'-'横线的宽度


android:dashGap 表示'-'横线之间的距离


<corners > 圆角


android:radius 圆角的半径 值越大角越圆


android:topRightRadius 右上圆角半径

android:bottomLeftRadius 右下圆角角半径

android:topLeftRadius 左上圆角半径


android:bottomRightRadius 左下圆角半径


】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇Android开发教程:实现没有标题栏.. 下一篇Android开发教程:Popupwindow的..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: