drawable 文件夹下新建 xml 文件:


shape_第1张图片
  • android:shape

设置 shape 形状。

  • rectagle 矩形
  • oval 椭圆
  • line 水平直线
  • ring 环形

一、solid:填充


  • android:color

指定填充的颜色。

二、gradient:渐变


  • android:startColor

指定起始颜色。

  • android:endColor

指定结束颜色。

  • android:angle

渐变角度,必须为 45 的整数倍。

  • android:type

渐变模式。

  • linear:线性渐变,默认。
    shape_第2张图片
  • radial:径向渐变。需要指定半径** android:gradientRadius="50dp"**。
  • sweep:扫描式渐变

三、stroke:描边


  • android:width

描边的宽度。

  • android:color

描边的颜色。

  • android:dashWidth

描边为虚线形势,小线段的长度。

  • android:dashGap

小线段的间距。

四、corners:圆角


  • android:Radius

设置四个角的半径。

  • android:topLeftRadius

设置左上角的半径。

  • android:topRightRadius

设置右上角的半径。

  • android:bottomLeftRadius

设置左下角的半径。

  • android:bottomRightRadius

设置右下角的半径。

  • 后四个都设置了则第一个失效。

五、padding:间隔


  • android:top

  • android:android:bottom

  • android:android:left

  • android:android:right

更多相关文章

  1. Android TextView 设置超链,设置部分字体颜色
  2. android 4.2修改设置菜单的背景颜色
  3. Android App更改背景颜色
  4. C#根据表格偶数与奇数加载不同颜色的实例分析
  5. c语言颜色代码
  6. c语言实现输入圆的半径计算圆的面积
  7. go语言如何改变回显颜色
  8. 详细介绍使用XML资源文件来定义颜色,样式等
  9. Android color(颜色) 在XML文件和java代码中的代码详细介绍

随机推荐

  1. Android:利用 LeakCanary 来检查 Android
  2. Android layout之优化:使用include和merge
  3. Android framework : UI刷新机制:Vsync an
  4. Android(安卓)Adapter体系介绍
  5. World of Goo(粘粘世界)即将登陆 Android M
  6. 修改开机画面:initlogo.rle
  7. Android系统设置通用接口的编写
  8. Android ActionBar详解
  9. Android Handler 小结
  10. Android(安卓)沉浸式全屏的实现方法