如何在Android中制作具有进度状态的圆形progresbar? [英] how to make circular progresbar with progress status in android?

查看:65
本文介绍了如何在Android中制作具有进度状态的圆形progresbar?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想显示进度条(如下图)以及进度状态,任何机构都可以为我提供解决方案

解决方案

我在

上看到了一个示例

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

它将帮助您解决您的问题

在布局中添加视图并相应地使用(完整的示例代码和资源可在给定的链接上找到,请按以下说明下载和使用)

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

并在您的Java代码中按以下方式使用它

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

另一个很好的例子也可以在

https://github.com/ylyc/circular_progress_bar

在此示例中

在布局中包含xml.

<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" />

styles.xml中有2种预定义样式可供选择,即Widget.ProgressBar.Holo.CircularProgressBar,Widget.ProgressBar.CircularProgressBar

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

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

您可以像这样设置标题,字幕和进度

CircularProgressBar c3 = (CircularProgressBar) findViewById(R.id.circularprogressbar3);
c3.setTitle("June");
c3.setSubTitle("2013");
c3.setProgress(42);

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

解决方案

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

这篇关于如何在Android中制作具有进度状态的圆形progresbar?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆