Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ProgressBar thickness

Tags:

android

Look at the images below :

  • enter image description here
  • enter image description here
  • enter image description here

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.

like image 673
Sergey Shustikov Avatar asked Jun 10 '15 09:06

Sergey Shustikov


2 Answers

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.

like image 164
Moinkhan Avatar answered Sep 21 '22 01:09

Moinkhan


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" 
like image 27
Abhishek Avatar answered Sep 21 '22 01:09

Abhishek