Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Horizontal progress bar with icon

In my project I want to make a horizontal progress bar similar to the following.

HERE

I've tried a lot of libraries but none of them have this feature. Is there any way to make this?

Here is my code:

dialog = new ProgressDialog(Context.this);
dialog.setIndeterminate(true);
dialog.setMessage("Some Text");
dialog.show();
like image 325
Canberk Çakmak Avatar asked Sep 05 '26 23:09

Canberk Çakmak


1 Answers

You should use seekBar instead of progressDialog. And you can add android:thumb icon.

<SeekBar
    android:id="@+id/seekBar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:thumb="@drawable/icon"
    android:max="10"
    android:progress="5"
    android:progressDrawable="@drawable/custom_seekbar" />

custom-seekbar.xml:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:id="@android:id/progress">
        <clip>
            <shape android:shape="rectangle">
                <size
                    android:width="12dp"
                    android:height="12dp" />
                <corners android:radius="15dp" />

                <solid android:color="#4fc3f7" />

                <gradient
                    android:angle="270"
                    android:centerColor="#4fc3f7"
                    android:endColor="#4fc3f7"
                    android:startColor="#4fc3f7" />
            </shape>
        </clip>
    </item>
</layer-list>
like image 111
propoLis Avatar answered Sep 07 '26 14:09

propoLis



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!