how to make circular progresbar with progress status in android?

梦想与她 提交于 2019-11-29 15:16:26

问题


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


回答1:


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);


来源:https://stackoverflow.com/questions/22657702/how-to-make-circular-progresbar-with-progress-status-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!