半透明镂空、圆形、动画 的进度条,仿微信和微博

412 阅读1分钟

HoverProcessView

github.com/hzw1199/Hov…

YouTube:

IMAGE ALT TEXT

Features

  • 仿微信和微博的镂空半透明圆形进度

  • 支持开启和关闭动画

  • 背景支持圆角矩形

  • layout

<com.wuadam.hoverprocess.HoverProcessView
    android:id="@+id/process"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:duration="1000"
    app:hoverColor="#80000000"
    app:max="100"
    app:progress="30"
    app:radius="48dp"
    app:ringWidth="4dp"
    app:roundCornerRadius="8dp" />

支持的 xml 属性

Attributeformatdescribedefault
hoverColorcolor背景和进度圆形的颜色#000000
radiusdimension进度圆形半径50 px
ringWidthdimension背景和进度圆形之间的透明圆环宽度5 px
maxinteger进度最大值100
progressinteger初始进度0
ringPaddingdimension透明圆环padding0
durationinteger进度圆形转满一圈所需的时间毫秒数400
roundCornerRadiusdimension背景圆角半径0
  • java
HoverProcessView process = findViewById(R.id.process);

动画模式

process.setProgress(50, true);

无动画模式

process.setProgress(50, false);

无限模式

process.startInfiniteProgress();
process.stopInfiniteProgress();

onDestroy:

process.stop();