how to make circular progresbar with progress status in android?

前端 未结 1 920
面向向阳花
面向向阳花 2021-01-01 04:51

I want to show the progress bar like below image along with progress status, can any body give me the solution for this

相关标签:
1条回答
  • 2021-01-01 05:35

    Hi i have seen an example at

    https://github.com/passsy/android-HoloCircularProgressBar

    it will help you to achieve yours problem

    Add the View in your Layout and use accordingly (the full example code and resources are available at given link , please download and use as follows)

    <de.passsy.holocircularprogressbar.HoloCircularProgressBar
        android:id="@+id/holoCircularProgressBar1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>
    

    and use it as follows in yours java code

    HoloCircularProgressBar mHoloCircularProgressBar = (HoloCircularProgressBar) findViewById(R.id.holoCircularProgressBar1);
    

    another good example is also available at

    https://github.com/ylyc/circular_progress_bar

    in this example

    Include the xml in the layout.

    <com.lylc.widget.circularprogressbar.example.CircularProgressBar
        android:id="@+id/circularprogressbar1"
        style="@style/Widget.ProgressBar.Holo.CircularProgressBar"
        android:layout_width="120dip"
        android:layout_height="120dip"
        android:layout_marginTop="10dip"
        circular:subtitle="subtitle"
        circular:title="Title" />
    

    There are 2 pre-defined styles to choose from, Widget.ProgressBar.Holo.CircularProgressBar, Widget.ProgressBar.CircularProgressBar in styles.xml

    <style name="Widget.ProgressBar.CircularProgressBar" parent="Widget">
        ...
    </style>
    
    <style name="Widget.ProgressBar.Holo.CircularProgressBar" parent="Widget.ProgressBar.CircularProgressBar">
        ...
    </style>
    

    You can set the title, subtitle and the progress like so

    CircularProgressBar c3 = (CircularProgressBar) findViewById(R.id.circularprogressbar3);
    c3.setTitle("June");
    c3.setSubTitle("2013");
    c3.setProgress(42);
    
    0 讨论(0)
提交回复
热议问题