本文整理匯總了Java中android.animation.ValueAnimator.setObjectValues方法的典型用法代碼示例。如果您正苦於以下問題:Java ValueAnimator.setObjectValues方法的具體用法?Java ValueAnimator.setObjectValues怎麽用?Java ValueAnimator.setObjectValues使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.animation.ValueAnimator
的用法示例。
在下文中一共展示了ValueAnimator.setObjectValues方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: startCloudTemplate
import android.animation.ValueAnimator; //導入方法依賴的package包/類
private void startCloudTemplate(String mapTag, long delay, final CircleInfo circleInfo){
ValueAnimator valueAnimator=animMap.get(mapTag);
if (valueAnimator==null){
valueAnimator=ValueAnimator.ofObject(new CircleTypeEvaluator(circleInfo),new CircleInfo(circleInfo.getX(),circleInfo.getY()+circleInfo.getRadius(),0)
,new CircleInfo(circleInfo.getX(),circleInfo.getY(),circleInfo.getRadius()));
valueAnimator.setDuration(600);
valueAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
super.onAnimationStart(animation);
circleInfo.setCanDraw(true);
}
});
animMap.put(mapTag,valueAnimator);
}
valueAnimator.setObjectValues(new CircleInfo(circleInfo.getX(),circleInfo.getY()+circleInfo.getRadius(),0)
,new CircleInfo(circleInfo.getX(),circleInfo.getY(),circleInfo.getRadius()));
valueAnimator.setStartDelay(delay);
startValueAnimator(valueAnimator);
}
示例2: setCodeSegment
import android.animation.ValueAnimator; //導入方法依賴的package包/類
private void setCodeSegment(final TextView codeView, String segment) {
if (Build.VERSION.SDK_INT >= 11) {
ValueAnimator valueAnimator = new ValueAnimator();
valueAnimator.setObjectValues(0, Integer.parseInt(segment));
valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@RequiresApi(api = Build.VERSION_CODES.HONEYCOMB)
@Override
public void onAnimationUpdate(ValueAnimator animation) {
int value = (int) animation.getAnimatedValue();
codeView.setText(String.format("%05d", value));
}
});
valueAnimator.setEvaluator(new TypeEvaluator<Integer>() {
public Integer evaluate(float fraction, Integer startValue, Integer endValue) {
return Math.round(startValue + (endValue - startValue) * fraction);
}
});
valueAnimator.setDuration(1000);
valueAnimator.start();
} else {
codeView.setText(segment);
}
}