标签:加速球
一个自定义控件:
地址:
git:https://github.com/guoGavin/CustomAccelerateBall
csdn:http://download.csdn.net/detail/jiguangcanhen/8687305
accelerate ball,加速球效果,也就是圆形的ProgressBar的效果。
录制效果不是很好
<com.test.gavinguo.customaccelerateball.AccelerateBallView
android:id="@+id/ball"
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_marginTop="50dp"
android:layout_gravity="center_horizontal"/>
public enum GalleryType{
NoneAnimationAndPercent,//没有动画和百分比文字
NoneAnimationHavePercent,//没有动画但是有文本
AnimationOnly,//只有动画
AnimationAndPercent,//具有动画和百分比,default
}
public enum Speed{
slow,//低速
medium,//中速,default
fast,//高速
superFast,//超高速
random,//随机速度
}
public enum RefreshSpeed{
slow,//低速
medium,//中速,default
fast,//高速
superFast,//超高速
}
public interface AccelerateBallUpdateListener{
/**
* 每次变化
* @param currentPercent 当前百分比
*/
void updateLeveUp(int currentPercent);
/**
* 上涨结束调用
* @param endPercent 结束时候的百分比
*/
void endLeveUp(int endPercent);
}
ball = (AccelerateBallView) findViewById(R.id.ball);
ball.setSpeedType(AccelerateBallView.Speed.superFast);
ball.setRefreshSpeedType(AccelerateBallView.RefreshSpeed.superFast);
ball.setGalleryType(AccelerateBallView.GalleryType.AnimationAndPercent);
ball.setAccelerateBallUpdateListener(new AccelerateBallView.AccelerateBallUpdateListener() {
@Override
public void updateLeveUp(int currentPercent) {
//do nothing
}
@Override
public void endLeveUp(int endPercent) {
//do nothing
}
});
start.setOnClickListener(this);
ball.setTotalLevel(totalLevel);
Total可以不停的去设置,加速球最终会停止在最后设置的位置。
标签:加速球
原文地址:http://blog.csdn.net/jiguangcanhen/article/details/45645979