【问题标题】:Loading progress bar like Telegram像 Telegram 一样加载进度条
【发布时间】:2020-11-30 09:20:35
【问题描述】:

我想要完全像这样的加载过程:

我试试这个:

    <style name="CustomProgress" parent="Theme.AppCompat.Dialog">
    <item name="android:windowBackground">@color/transparent</item>
    <item name="android:backgroundDimEnabled">false</item>
    <item name="colorAccent">@color/colorPrimary</item>
</style>

pDialog = new ProgressDialog(getContext(), R.style.CustomProgress);

但这并不是我想要的!

【问题讨论】:

  • 有很多第三方库可以为你提供这么酷的进度条试试这个:github.com/ybq/Android-SpinKit
  • 谢谢,但我不想使用图书馆。我想使用样式和 CustomProgress。
  • 您可以尝试自定义圆圈进度条以匹配您需要的内容。至少,试一试

标签: android android-progressbar


【解决方案1】:

创建圆形可绘制progress_background.xml

<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval">
<solid android:color="#BC000000" />

您可以直接使用进度条本身的背景。您也可以使用style

 <ProgressBar
            android:indeterminateTint="@android:color/white"
            android:indeterminateTintMode="src_in"
            android:layout_width="wrap_content"
            android:padding="4dp"
            android:layout_centerInParent="true"
            android:layout_gravity="center"
            android:background="@drawable/progress"
            android:layout_height="wrap_content"/>

android:indeterminateTint 在 21+ 可用。如果您的最低 SDK 版本较低,那么您可以通过其他方式更改进度条颜色,但您明白了。

【讨论】:

    猜你喜欢
    • 2015-08-17
    • 1970-01-01
    • 1970-01-01
    • 2011-10-18
    • 2011-02-28
    • 1970-01-01
    • 2011-12-22
    • 1970-01-01
    • 2015-12-23
    相关资源
    最近更新 更多