How to set thickness of circular indeterminate progress bar android?

烈酒焚心 提交于 2019-12-23 12:56:00

问题


I have two nested circular indeterminate progress bars but I cannot set their thickness to an equal size. I have tried to customize it using shapes. However, that removes the default behaviour of the circular indeterminate progress. I customize like this and it made thickness equal but not getting default behaviour.

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:id="@android:id/progress">
        <rotate android:toDegrees="360">
            <shape
                android:shape="ring"
                android:thickness="4dp">
                <solid android:color="@color/white" />
            </shape>
        </rotate>
    </item>
</layer-list>

<ProgressBar
      android:id="@+id/download_progress4"
      android:layout_width="85dp"
      android:layout_height="85dp"
      android:layout_gravity="center"
      android:indeterminate="true"
      android:indeterminateDrawable="@style/ProgressThem" />

I want like this with default behaviour of circular indeterminate progress bar


回答1:


Try this

USE

android:innerRadiusRatio="3"
android:thicknessRatio="20.0

SAMPLE CODE

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:id="@android:id/progress">
        <rotate android:toDegrees="360">
            <shape
                android:shape="ring"
                android:thickness="4dp"
                android:innerRadiusRatio="3"
                android:thicknessRatio="20.0">
                <solid android:color="@color/white" />
            </shape>
        </rotate>
    </item>
</layer-list>


来源:https://stackoverflow.com/questions/48581834/how-to-set-thickness-of-circular-indeterminate-progress-bar-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!