Back to project page CircleProgressBar.
The source code is released under:
Apache License
If you think the Android project CircleProgressBar listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package net.canking.circleprogressbar; /*from ww w . java2 s . c o m*/ import android.content.Context; import android.graphics.Canvas; import android.util.AttributeSet; import android.widget.ImageView; public class LoadingView extends ImageView implements Runnable { private boolean isStop = false; private int[] imageIds; private int index = 0; private int length = 1; public LoadingView(Context context) { this(context, null); } public LoadingView(Context context, AttributeSet attrs) { super(context, attrs); } public void setImageIds(int[] imageId) { this.imageIds = imageId; if(imageIds != null && imageIds.length > 0) { length = imageIds.length; } } @Override protected void onDetachedFromWindow() { // TODO Auto-generated method stub super.onDetachedFromWindow(); isStop = true; } @Override protected void onDraw(Canvas canvas) { // TODO Auto-generated method stub super.onDraw(canvas); if(imageIds != null && imageIds.length > 0) { this.setImageResource(imageIds[index]); } } @Override public void run() { while(!isStop) { //???????????? index = ++index % length; postInvalidate(); try { Thread.sleep(400); } catch (InterruptedException e) { e.printStackTrace(); } } } //???????????? public void startAnim() { new Thread(this).start(); } }