android - 如何制作一个实心圆形进度条?(不使用外部库)
问题描述
我想在 Android Studio 中制作一个圆形填充进度条。我的目标是实现这样的目标;
例如,第一张图像的进度值为 100,然后每隔一秒就会有一点圆圈消失,直到什么也没有。
我试过这个,但我无法让我的存储库工作,因此我正在寻找一种更“非外部”的方式来做到这一点。
解决方案
借助Material Components 库,您可以使用官方的CircularProgressIndicator
.
就像是:
<com.google.android.material.progressindicator.CircularProgressIndicator
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:trackThickness="20dp"
/>
如果您使用的是jetpack Compose,您可以使用CircularProgressIndicator
:
CircularProgressIndicator(
strokeWidth = 20.dp,
progress = animatedProgress.value)
推荐阅读
- javascript - d3 气泡图定位和侧气泡中的文本
- android - 在 Chrome CustomTab 中打开 Google Form Url 会重定向到安装了 Chrome 浏览器的设备
- botframework - 如何将整个对话从机器人保存到存储中?
- android - 使用 API 26 调用 - API 23 Android 中的 transientExtras
- git - git如何管理存储文件分支明智?
- asp.net-core - 禁用 IIS 客户端证书信任检查和验证
- r - 循环为R中的不同变量设置命令列表?
- sql-server - 如何在没有连接字符串的情况下打开 EntityConnection
- powershell - 使用 MS Graph(或 PowerShell)创建 MS Teams 聊天
- oracle - 是什么导致使用 Apache Nifi 从 Oracle 到 Bigquery 的数据传输出现空指针异常错误?