Sergey Shustikov
Sergey Shustikov

Reputation: 15821

ProgressBar thickness

Look at the images below :

On each image ProgressBar has different style from another ProgressBar's.

I want to know, how i can specify progress bar style/thin in my application.

I look at android.R.attr.progressBarStyleSmall but it just change a size of progress bar, not a thickness of a spinning circle.

Note : Don't post answers which suppose create a custom drawables. Libraries allow.

Upvotes: 8

Views: 12033

Answers (2)

Abhishek
Abhishek

Reputation: 1345

Can't say whether you can deal with these default progress bars, but you can try with an alternative design your own progress image and perform animation over it like here,

enter image description here

Now add this in res/drawable/customprogress.xml

<rotate xmlns:android="http://schemas.android.com/apk/res/android"
    android:fromDegrees="0"
    android:pivotX="50%"
    android:pivotY="50%"
    android:toDegrees="360" >
    <shape
        android:shape="oval"
        android:useLevel="false" >
        <size
            android:height="48dip"
            android:width="48dip" />
        <gradient
            android:centerColor="#ff000000"
            android:centerY="0.50"
            android:endColor="#ff00ff00"
            android:startColor="#ff000000"
            android:type="sweep"
            android:useLevel="false" />
    </shape>
</rotate>

and add this progressbar attribute

android:indeterminateDrawable="@drawable/customprogress" 

Upvotes: 5

Moinkhan
Moinkhan

Reputation: 12932

You may try this git library it will help you and give more customization ...

https://github.com/castorflex/SmoothProgressBar

mProgressBar.setIndeterminateDrawable(new SmoothProgressDrawable.Builder(context)
    .strokeWidth(8f)            //You should use Resources#getDimension
    .build());

You can give any stroke width here.

Upvotes: 5

Related Questions