下面的属性只有在android:shape="ring时可用:

android:innerRadius 尺寸,内环的半径。

android:innerRadiusRatio 浮点型,以环的宽度比率来表示内环的半径,

例如,如果android:innerRadiusRatio,表示内环半径等于环的宽度除以5,这个值是可以被覆盖的,默认为9.

android:thickness 尺寸,环的厚度

android:thicknessRatio 浮点型,以环的宽度比率来表示环的厚度,例如,如果android:thicknessRatio="2",

那么环的厚度就等于环的宽度除以2。这个值是可以被android:thickness覆盖的,默认值是3.

android:useLevel boolean值,如果当做是LevelListDrawable使用时值为true,否则为false.

<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:pivotX="50%" android:pivotY="50%" //围绕旋转的中心点。50%表示围绕圆心旋转
android:fromDegrees="0" android:toDegrees="360">
<shape
android:shape="ring"
android:innerRadiusRatio="3"
android:thicknessRatio="8"
android:useLevel="false">
<gradient
android:type="sweep"
android:useLevel="false"
android:startColor="#ffffffff"
android:centerColor="#ff808080"
android:centerY="0.45"
android:endColor="#ff000000"/>
</shape>
</rotate>

<shape android:shape="rectangle" //矩形
xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@android:color/white" /> //矩形的颜色
<stroke android:width="2.0dip" android:color="#00ff00" /> //矩形边框的宽度和颜色
<corners android:radius="4.0dip" /> //矩形圆角的半径
</shape>

更多相关文章

  1. android textview xml 属性设置
  2. Android中的Shape使用总结—圆角的按钮
  3. android为文本框设置背景资源-shape
  4. Android:控件GridView的使用
  5. Android:控件GridView的使用
  6. android shape的使用
  7. Android(安卓)使用 TableLayout 布局拉伸宽度
  8. Android(安卓)使用 TableLayout 布局拉伸宽度
  9. Android修炼之道——Shape

随机推荐

  1. ARCH及其扩展模型的操作步骤, 程序和各种
  2. *中国县域统计年鉴, 人口与就业统计年鉴1
  3. 人工智能自拍之后,会怎样给自己P图?
  4. ARIMA时间序列模型的步骤, 程序和各种检
  5. 添加一个新变量能使以前不显著的变量变得
  6. 线索二叉树(C语言)
  7. 谷歌、脸书、魔兽世界都在用!InnoDB是什么
  8. 从1997投稿到2021年被Top5刊接受, 从不惑
  9. 加入其他控制变量后, 估计系数的符号相反
  10. 封禁TikTok?这次美国政府恐怕不能再为所欲