本文整理汇总了Java中android.animation.ObjectAnimator.setTarget方法的典型用法代码示例。如果您正苦于以下问题:Java ObjectAnimator.setTarget方法的具体用法?Java ObjectAnimator.setTarget怎么用?Java ObjectAnimator.setTarget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.animation.ObjectAnimator
的用法示例。
在下文中一共展示了ObjectAnimator.setTarget方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createBaseWobble
import android.animation.ObjectAnimator; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private ObjectAnimator createBaseWobble(final View v) {
if (!isPreLollipop())
v.setLayerType(LAYER_TYPE_SOFTWARE, null);
ObjectAnimator animator = new ObjectAnimator();
animator.setDuration(180);
animator.setRepeatMode(ValueAnimator.REVERSE);
animator.setRepeatCount(ValueAnimator.INFINITE);
animator.setPropertyName("rotation");
animator.setTarget(v);
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
v.setLayerType(LAYER_TYPE_NONE, null);
}
});
return animator;
}
示例2: build
import android.animation.ObjectAnimator; //导入方法依赖的package包/类
/**
* build a copy of given animator
*
* @return
*/
public Animator build() {
//这种方式clone出来的animator不能重复播放
/*final ObjectAnimator result = getAnimator().clone();//克隆一份
setupListeners(result);
result.setupStartValues();
return result;*/
final ObjectAnimator self = this.getAnimator();
final ObjectAnimator anim = new ObjectAnimator();
anim.setTarget(self.getTarget());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
anim.setAutoCancel(true);
}
if (self.getValues() != null) {
anim.setValues(self.getValues());
}
anim.setInterpolator(self.getInterpolator());
anim.setDuration(self.getDuration());
anim.setStartDelay(self.getStartDelay());
anim.setRepeatCount(self.getRepeatCount());
anim.setRepeatMode(self.getRepeatMode());
setupListeners(anim);
return anim;
}
示例3: with
import android.animation.ObjectAnimator; //导入方法依赖的package包/类
/**
* 设置target
*
* @param udView
* @return
*/
public UDAnimator with(UDView udView) {
final ObjectAnimator animator = getAnimator();
if (animator != null && udView != null && udView.getView() != null) {
mTarget = udView;
animator.setTarget(udView.getView());
}
return this;
}
示例4: loadObjectAnimator
import android.animation.ObjectAnimator; //导入方法依赖的package包/类
private ObjectAnimator loadObjectAnimator(final int resId, final Object target) {
if (resId == 0) {
// TODO: Stop returning null.
return null;
}
final ObjectAnimator animator = (ObjectAnimator)AnimatorInflater.loadAnimator(
getContext(), resId);
if (animator != null) {
animator.setTarget(target);
}
return animator;
}
示例5: initAnimator
import android.animation.ObjectAnimator; //导入方法依赖的package包/类
private void initAnimator() {
mPressAnimator = ObjectAnimator.ofFloat(this, DEGREE, 0, -45);
mPressAnimator.setDuration(1000);
mUpAnimator = new AnimatorSet();
mDegreeAnimator = new ObjectAnimator();
mDegreeAnimator.setTarget(this);
mDegreeAnimator.setProperty(DEGREE);
mBallAnimator = new ObjectAnimator();
mBallAnimator.setTarget(this);
mBallAnimator.setProperty(BALLLOCATION);
mUpAnimator.playTogether(mDegreeAnimator, mBallAnimator);
}
示例6: ProgressBarView
import android.animation.ObjectAnimator; //导入方法依赖的package包/类
public ProgressBarView(ContainerType containerType, ViewGroup container,
XSharedPreferences prefs, ProgressBarController ctrl) {
super(container.getContext());
mContainerType = containerType;
mCtrl = ctrl;
mAnimated = prefs.getBoolean(GravityBoxSettings.PREF_KEY_STATUSBAR_DOWNLOAD_PROGRESS_ANIMATED, true);
mCentered = prefs.getBoolean(GravityBoxSettings.PREF_KEY_STATUSBAR_DOWNLOAD_PROGRESS_CENTERED, false);
mHeightPx = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
prefs.getInt(GravityBoxSettings.PREF_KEY_STATUSBAR_DOWNLOAD_PROGRESS_THICKNESS, 1),
getResources().getDisplayMetrics());
mEdgeMarginPx = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
prefs.getInt(GravityBoxSettings.PREF_KEY_STATUSBAR_DOWNLOAD_PROGRESS_MARGIN, 0),
getResources().getDisplayMetrics());
setScaleX(0f);
setBackgroundColor(Color.WHITE);
setVisibility(View.GONE);
container.addView(this);
mAnimator = new ObjectAnimator();
mAnimator.setTarget(this);
mAnimator.setInterpolator(new DecelerateInterpolator());
mAnimator.setDuration(ANIM_DURATION);
mAnimator.setRepeatCount(0);
}