美文网首页
学习Android界面开发: Shape Drawable

学习Android界面开发: Shape Drawable

作者: zoudaokou2006 | 来源:发表于2016-06-23 00:14 被阅读238次

<shape>

用于绘制几何形状(geometric shape)
支持以下属性:

形状 android:shape

  • rectangle 长方形
  • ring 圆形
  • oval 椭圆形
  • line 直线

内边框填充 <padding>

当Shape用作View的android:background时,Shape的<padding>属性将应用于View。但是,当View显式设置了<padding>时,Shape 的<padding>无效。

填充颜色 <solid>

填充渐变色 <gradient>

  • android:startColor 起始色
  • android:endColor 结束色
  • android:centerColor 中间色
  • android:centerX 横向中间位置
  • android:centerY 纵向中间位置

注意:<solid>会覆盖<gradient>属性

笔划 <stroke>

  • android:width 粗细
  • android:color 颜色
  • android:dashGap 虚线间的间隔
  • android:dashWidth 虚线的宽度

笔划可以是实线或者虚线。
同时设置android:dashWidth和android:dashGap时,笔划为虚线。

相关文章

网友评论

      本文标题:学习Android界面开发: Shape Drawable

      本文链接:https://www.haomeiwen.com/subject/sbundttx.html