Skip to content

HoloCircularProgressBar

James Montemagno edited this page Aug 14, 2013 · 5 revisions

What is a HoloCircularProgressBar

HoloCircularProgressBar is a Custom View implementation for Android you might know from the Android Clock App from Android 4.1. Ported from https://github.com/passsy/android-HoloCircularProgressBar

Circular Progress Bar Circular Progress Bar2

Usage

Sample project

Included in the repo is a project with a sample of it working and themed.

Use it in your Code

Add the view in your layout:

<com.refractored.monodroidtoolkit.HoloCircularProgressBar
    android:id="@+id/holoCircularProgressBar1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>

There are several XML attributes you can add the the HoloCircularProgressBar:

<com.refractored.monodroidtoolkit.HoloCircularProgressBar
    android:id="@+id/holoCircularProgressBar1"
    android:layout_height="wrap_content"
    android:layout_width="wrap_content"
    app:circular_stroke_width="10dp"
    app:circular_progress="40"
    app:circular_marker_progress="60"
    app:circular_progress_color="@android:color/holo_orange_dark"
    app:circular_progress_background_color="#cccccc"
    app:circular_gravity="center"
    app:circular_indeterminate="false"
    app:circular_indeterminate_interval="50"/>

Style

Don't forget to add a default style to your AppTheme

<style name="AppTheme" parent="android:Theme.Holo">
    <item name="circularProgressBarStyle">@style/CircularProgressBar</item>
</style>

I added two simple styles @style/CircularProgressBar and @style/CircularProgressBarLight to give you a quick start. You can see both styles in action in the sample Project