本文整理匯總了Java中com.nineoldandroids.animation.ValueAnimator.ofObject方法的典型用法代碼示例。如果您正苦於以下問題:Java ValueAnimator.ofObject方法的具體用法?Java ValueAnimator.ofObject怎麽用?Java ValueAnimator.ofObject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.nineoldandroids.animation.ValueAnimator
的用法示例。
在下文中一共展示了ValueAnimator.ofObject方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: SegmentTabLayout
import com.nineoldandroids.animation.ValueAnimator; //導入方法依賴的package包/類
public SegmentTabLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
setWillNotDraw(false);//重寫onDraw方法,需要調用這個方法來清除flag
setClipChildren(false);
setClipToPadding(false);
this.mContext = context;
mTabsContainer = new LinearLayout(context);
addView(mTabsContainer);
obtainAttributes(context, attrs);
//get layout_height
String height = attrs.getAttributeValue("http://schemas.android.com/apk/res/android", "layout_height");
//create ViewPager
if (height.equals(ViewGroup.LayoutParams.MATCH_PARENT + "")) {
} else if (height.equals(ViewGroup.LayoutParams.WRAP_CONTENT + "")) {
} else {
int[] systemAttrs = {android.R.attr.layout_height};
TypedArray a = context.obtainStyledAttributes(attrs, systemAttrs);
mHeight = a.getDimensionPixelSize(0, ViewGroup.LayoutParams.WRAP_CONTENT);
a.recycle();
}
mValueAnimator = ValueAnimator.ofObject(new PointEvaluator(), mLastP, mCurrentP);
mValueAnimator.addUpdateListener(this);
}
示例2: CommonTabLayout
import com.nineoldandroids.animation.ValueAnimator; //導入方法依賴的package包/類
public CommonTabLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
setWillNotDraw(false);//重寫onDraw方法,需要調用這個方法來清除flag
setClipChildren(false);
setClipToPadding(false);
this.mContext = context;
mTabsContainer = new LinearLayout(context);
addView(mTabsContainer);
obtainAttributes(context, attrs);
//get layout_height
String height = attrs.getAttributeValue("http://schemas.android.com/apk/res/android", "layout_height");
//create ViewPager
if (height.equals(ViewGroup.LayoutParams.MATCH_PARENT + "")) {
} else if (height.equals(ViewGroup.LayoutParams.WRAP_CONTENT + "")) {
} else {
int[] systemAttrs = {android.R.attr.layout_height};
TypedArray a = context.obtainStyledAttributes(attrs, systemAttrs);
mHeight = a.getDimensionPixelSize(0, ViewGroup.LayoutParams.WRAP_CONTENT);
a.recycle();
}
mValueAnimator = ValueAnimator.ofObject(new PointEvaluator(), mLastP, mCurrentP);
mValueAnimator.addUpdateListener(this);
}
示例3: getBezierValueAnimator
import com.nineoldandroids.animation.ValueAnimator; //導入方法依賴的package包/類
private ValueAnimator getBezierValueAnimator(View target) {
EmanateCore evaluator = new EmanateCore(getPointF(2),getPointF(1));
ValueAnimator animator = ValueAnimator.ofObject(evaluator,
new PointF(mX,mY),
new PointF(mRandom.nextInt(getWidth()),0));
animator.addUpdateListener(new BezierListenr(target));
animator.setTarget(target);
animator.setDuration(3000);
return animator;
}