Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to implement this type of Progressbar in android using xml file

How to apply glow effect?

I am trying to create this type of horizontal ProgressBar but no idea about the glowing effect for as starting point of progress.

enter image description here

Here is my code for gradient color

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >

    <item android:id="@android:id/background">
        <shape>
            <corners android:radius="0dip" />

        <solid android:color="#ff9d9e9d"/>
        </shape>
    </item>
    <item android:id="@android:id/secondaryProgress">
        <clip>
            <shape>
                <corners android:radius="5dip" />

            <gradient
                    android:angle="180"
                    android:startColor="#8872f8fc"
                    android:endColor="#886dc0e3" />
            </shape>
        </clip>
    </item>
    <item android:id="@android:id/progress">
        <clip>
            <shape>
                <corners android:radius="5dip" />

                <gradient
                    android:angle="180"
                    android:startColor="#31c6f7"
                    android:centerColor="#2ea6d1"
                    android:endColor="#2884a6" />
            </shape>
        </clip>
    </item>

</layer-list>
like image 478
Pratik Avatar asked Mar 06 '13 09:03

Pratik


People also ask

What is progressBar in Android?

Android ProgressBar is a graphical view indicator that shows some progress. Android progress bar displays a bar representing the completing of the task. Progress bar in android is useful since it gives the user an idea of time to finish its task.

What is the method of progress bar?

Progress bar supports two modes to represent progress: determinate, and indeterminate. For a visual overview of the difference between determinate and indeterminate progress modes, see Progress & activity. Display progress bars to a user in a non-interruptive way.


1 Answers

You can use a png image for glowing head. Use < bitmap> tag inside the layer-list and align it to right. I did a similar thing for a completely different application

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >

<item>
    <shape>
        <gradient
            android:angle="270"
            android:endColor="#4C4C4C"
            android:startColor="#303030" />

        <stroke
            android:width="0dp"
            android:color="#000000" />

        <corners android:radius="0dp" />

        <padding
            android:bottom="0dp"
            android:left="5dp"
            android:right="0dp"
            android:top="0dp" />
    </shape>
</item>
<item>
    <bitmap
        android:antialias="true"
        android:gravity="right|bottom|fill_vertical"
        android:src="@drawable/spinner_down_arrow" />
</item>

</layer-list>
like image 53
sukhitha Avatar answered Oct 18 '22 21:10

sukhitha