Problem of change in size



  • Got it. 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 when I use it. android:progressDrawable of such a type:

    <?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>

    The bar &apos; s progress corresponds to the specified values.

    But when I want to do it, ProgressBar c 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">

                &lt;!--&lt;gradient--&gt;
                    &lt;!--android:startColor="#f9f7f7"--&gt;
                    &lt;!--android:endColor="#d91111"--&gt;
                    &lt;!--android:type="sweep" /&gt;--&gt;
                &lt;solid android:color="#d91111"/&gt;
            &lt;/shape&gt;
    &lt;/item&gt;
    &lt;item android:id="@android:id/progress"&gt;
            &lt;shape
                android:innerRadius="55dp"
                android:shape="ring"
                android:useLevel="true"
                android:thickness="6.0sp"&gt;
                &lt;rotate
                    android:fromDegrees="0"
                    android:toDegrees="360"
                    /&gt;
                &lt;!--&lt;gradient--&gt;
                    &lt;!--android:startColor="#70ed70"--&gt;
                    &lt;!--android:endColor="#f4f7f4"--&gt;
                    &lt;!--android:type="sweep" /&gt;--&gt;
    
                &lt;solid android:color="#70ed70"/&gt;
            &lt;/shape&gt;
    &lt;/item&gt;
    

    </layer-list>

    the size is halved, it doesn't understand why. The difference is on the pictures.

    введите сюда описание изображения введите сюда описание изображения



  • android:innerRadius="55dp" Put it away in your first example.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2