There is a ProgressBar
<ProgressBar android:id="@+id/progressBar" style="?android:attr/progressBarStyleHorizontal" android:layout_width="@dimen/progress_bar_width" android:layout_height="@dimen/progress_bar_height" android:rotation="-90" android:max="100" android:progress="0" android:progressDrawable="@drawable/shape_circular" /> It has a fixed width and height. The problem is that when I use the following for android:progressDrawable for it:
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:innerRadiusRatio="2.3" android:shape="ring" android:thickness="6sp" > <solid android:color="@color/colorGreen"/> </shape> Then the progress bar size corresponds to the set values.
But when I want to make a ProgressBar with progress and secondaryProgress and use as progressDrawable :
<?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item android:id="@android:id/secondaryProgress"> <shape android:shape="ring" android:useLevel="true" android:thickness="5sp"> <!--<gradient--> <!--android:startColor="#f9f7f7"--> <!--android:endColor="#d91111"--> <!--android:type="sweep" />--> <solid android:color="#d91111"/> </shape> </item> <item android:id="@android:id/progress"> <shape android:innerRadius="55dp" android:shape="ring" android:useLevel="true" android:thickness="6.0sp"> <rotate android:fromDegrees="0" android:toDegrees="360" /> <!--<gradient--> <!--android:startColor="#70ed70"--> <!--android:endColor="#f4f7f4"--> <!--android:type="sweep" />--> <solid android:color="#70ed70"/> </shape> </item> </layer-list> then the size is reduced twice, it is not clear why. The difference in size can be seen in the pictures.


android:innerRadius="55dp"- Yuriy SPb ♦