android 固定进度环形刷新效果

android 固定进度无限旋转的环形效果

效果图

Activity 中使用

kotlin 复制代码
val rotation: ObjectAnimator = ObjectAnimator.ofFloat(progressBar, "rotation", 0f, 360f)
rotation.duration = ·000 // 旋转持续时间为2秒
rotation.repeatCount = ObjectAnimator.INFINITE // 设置为无限循环
rotation.interpolator = LinearInterpolator() // 设置匀速插值器
rotation.start()

布局样式

kotlin 复制代码
<ProgressBar
    android:id="@+id/progressBar"
    android:background="@drawable/pb_circular_bg"
    android:progressDrawable="@drawable/pd_circular_progress"
    android:indeterminateOnly="false"
    android:indeterminate="false"
    android:layout_width="50dp"
    android:layout_height="50dp"
    android:max="100"
    android:progress="25"/>

背景样式 pb_circula_bg.xml

kotlin 复制代码
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:innerRadiusRatio="3"
    android:shape="ring"
    android:thicknessRatio="8"
    android:useLevel="false">
    <solid android:color="@color/theme_c_d9" />
</shape>

进度样式 pd_circular_progress.xml

kotlin 复制代码
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:innerRadiusRatio="3"
    android:shape="ring"
    android:thicknessRatio="8"
    android:useLevel="true">
    <solid android:color="@color/colorPrimary" />
</shape>
相关推荐
警醒与鞭策4 小时前
【无标题】
android·unity·性能优化·游戏引擎·perforce
传奇开心果编程5 小时前
【Jetpack Compose进阶学与练】第14课:系列收尾复习总结;Compose项目常见坑点汇总;学习路线与后续学习方向
android·学习·ui·kotlin·android jetpack
李游Leo8 小时前
《HarmonyOS 7 精准碰一碰跨设备协作开发实战》07:异常恢复、状态机与CrossDrop工程收尾【鸿蒙心迹】
android·harmonyos
方白羽11 小时前
Android APK安全防护
android·安全·apk
小黄人软件11 小时前
AndroidStudio老项目 macOS运行BlueTooth蓝牙串口助手(Android+Studio源码).rar
android·macos
00后程序员张11 小时前
苹果App Store上架指南:费用、原理与步骤详解
android·ios·小程序·https·uni-app·iphone·webview
天神哥哥啊11 小时前
cocos联调注意事项-安卓
android
TDengine (老段)11 小时前
TDengine TSDB 实战排障四(升级与兼容)
android·java·大数据·数据库·物联网·时序数据库·tdengine
蓝速科技12 小时前
政务自助终端信创选型与无人值守落地方案
android·大数据·数据库·人工智能·科技·技术分享·政务
硫酸锌0113 小时前
在手机上运行Python增量备份手机数据到PC电脑
android·windows·python