Coder Social home page Coder Social logo

circular_progress_bar's Introduction

Android Circular Progress Bar

A simple subclass of android.widget.ProgressBar that contains title and subtitile in the center.

Application screenshot

License

Copyright (C) 2013 Leon Cheng Licensed under the Apache License, Verision 2.0

Layout

Make sure you have attrs.xml, colors.xml, styles.xml

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

Styles

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>

Attributes

There are few attributes defined in the attrs.xml.
Inorder to set the circularProgressBar attribute from the xml, make sure your layout xml contains an additional namespace.

xmlns:circular="http://schemas.android.com/apk/res/your_package_name"

Usage

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

Note that it is not using TextView for displaying; therefore, currently, it is limited to only text color.

You can also animate the progress bar to a specific number by

c2.animateProgressTo(0, 77, new ProgressAnimationListener() {
		
		@Override
		public void onAnimationStart() {				
		}
		
		@Override
		public void onAnimationProgress(int progress) {
			c2.setTitle(progress + "%");
		}
		
		@Override
		public void onAnimationFinish() {
			c2.setSubTitle("done");
		}
	});

circular_progress_bar's People

Contributors

ylyc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

circular_progress_bar's Issues

Auto animation start issue

When I define CircularProgressBar in programmatically, the bar is starting animation when app launched. But I didn't ANY define animation for it.

   CircularProgressBar c3=new CircularProgressBar(relativeLayout.getContext());
    relativeLayout.addView(c3);
    c3.setTitle(String.valueOf(yuzdeler[position]));
    c3.setSubTitle("GÜN KALDI");
    c3.setProgress(80);
    c3.setLayoutParams(lp);

Change subtitle and title size

Hello, thanks for gorgeous circle progress bar.

But how I can change subtitle and title size? Any idea? Cause I couldn't find the functions for that issues.

height and width fill parent

It is working fine when we give static height and width but when i use fill_parent for height and width it is not giving proper output, it is cutting some edges from right side. Any solutions for this?

Problem double speed animation

I have developed an app using both countdowntimer and circularprogressbar.

In most of devices, the app works perfect, and the duration of the countdowntimer and the circularprogressbar are correct. But in some devices, the animation of the circularprogressbar spend half time of the real duration. If I set the duration of the circularprogressbar to 1 minute, it ends in 30 seconds.

I think that is a problem of the objectanimator, can I change any parameter to get it work propertly?

Thank

how can i change the size of tittle?

Hello, circular progress bar is working great.
but its title font size varies according to android versions.
how can i set font size of title in my style.xml?

InflateException inflating CircularProgressBar

Hello,

When i launch my app with CircularProgressBar on tablets (which loads xlarge layout) i've NO PROBLEM.

But when i load it on smaller screen (with "normal" layout, not xlarge and not large) i have an inflateException during load of my layout XML at the line:

< com.mypackage.CircularProgressBar
android:id="@+id/cpbCheckupTest"
style="@style/Widget.ProgressBar.CircularProgressBar"
android:layout_width="40dp"
android:layout_height="40dp"/>

On small screens i tried with many devices with different version of android (Android 2.2 to Android 5.0 !) and it's the same problem.

But on big screens NO PROBLEMS!

The 2 files (xlarge layout and "normal" layout) are similars!
I don't understand......

Could you help me please?

Thanks a lot!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.