本文整理匯總了Java中android.animation.AnimatorInflater.loadAnimator方法的典型用法代碼示例。如果您正苦於以下問題:Java AnimatorInflater.loadAnimator方法的具體用法?Java AnimatorInflater.loadAnimator怎麽用?Java AnimatorInflater.loadAnimator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.animation.AnimatorInflater
的用法示例。
在下文中一共展示了AnimatorInflater.loadAnimator方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: checkIndicatorConfig
import android.animation.AnimatorInflater; //導入方法依賴的package包/類
private void checkIndicatorConfig(Context context) {
mIndicatorWidth = (mIndicatorWidth < 0) ? dip2px(DEFAULT_INDICATOR_WIDTH) : mIndicatorWidth;
mIndicatorHeight =
(mIndicatorHeight < 0) ? dip2px(DEFAULT_INDICATOR_WIDTH) : mIndicatorHeight;
mIndicatorMargin =
(mIndicatorMargin < 0) ? dip2px(DEFAULT_INDICATOR_WIDTH) : mIndicatorMargin;
mAnimatorResId = (mAnimatorResId == 0) ? R.animator.scale_with_alpha : mAnimatorResId;
mAnimationOut = AnimatorInflater.loadAnimator(context, mAnimatorResId);
if (mAnimatorReverseResId == 0) {
mAnimationIn = AnimatorInflater.loadAnimator(context, mAnimatorResId);
mAnimationIn.setInterpolator(new ReverseInterpolator());
} else {
mAnimationIn = AnimatorInflater.loadAnimator(context, mAnimatorReverseResId);
}
mIndicatorBackgroundResId = (mIndicatorBackgroundResId == 0) ? R.drawable.white_radius
: mIndicatorBackgroundResId;
mIndicatorUnselectedBackgroundResId =
(mIndicatorUnselectedBackgroundResId == 0) ? mIndicatorBackgroundResId
: mIndicatorUnselectedBackgroundResId;
}
示例2: createShowUpAnimator
import android.animation.AnimatorInflater; //導入方法依賴的package包/類
public Animator createShowUpAnimator(final View target) {
if (mHasCustomAnimationParams) {
final ObjectAnimator scaleXAnimator = ObjectAnimator.ofFloat(
target, View.SCALE_X, mShowUpStartXScale,
KEY_PREVIEW_SHOW_UP_END_SCALE);
final ObjectAnimator scaleYAnimator = ObjectAnimator.ofFloat(
target, View.SCALE_Y, mShowUpStartYScale,
KEY_PREVIEW_SHOW_UP_END_SCALE);
final AnimatorSet showUpAnimator = new AnimatorSet();
showUpAnimator.play(scaleXAnimator).with(scaleYAnimator);
showUpAnimator.setDuration(mShowUpDuration);
showUpAnimator.setInterpolator(DECELERATE_INTERPOLATOR);
return showUpAnimator;
}
final Animator animator = AnimatorInflater.loadAnimator(
target.getContext(), mShowUpAnimatorResId);
animator.setTarget(target);
animator.setInterpolator(DECELERATE_INTERPOLATOR);
return animator;
}
示例3: createDismissAnimator
import android.animation.AnimatorInflater; //導入方法依賴的package包/類
public Animator createDismissAnimator(final View target) {
if (mHasCustomAnimationParams) {
final ObjectAnimator scaleXAnimator = ObjectAnimator.ofFloat(
target, View.SCALE_X, mDismissEndXScale);
final ObjectAnimator scaleYAnimator = ObjectAnimator.ofFloat(
target, View.SCALE_Y, mDismissEndYScale);
final AnimatorSet dismissAnimator = new AnimatorSet();
dismissAnimator.play(scaleXAnimator).with(scaleYAnimator);
final int dismissDuration = Math.min(mDismissDuration, mLingerTimeout);
dismissAnimator.setDuration(dismissDuration);
dismissAnimator.setInterpolator(ACCELERATE_INTERPOLATOR);
return dismissAnimator;
}
final Animator animator = AnimatorInflater.loadAnimator(
target.getContext(), mDismissAnimatorResId);
animator.setTarget(target);
animator.setInterpolator(ACCELERATE_INTERPOLATOR);
return animator;
}
示例4: onCreate
import android.animation.AnimatorInflater; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_timer);
tvHour = (TextView) findViewById(R.id.tvHour);
tvSeparator = (TextView) findViewById(R.id.tvSeparator);
tvMinute = (TextView) findViewById(R.id.tvMinute);
tvHour.setText(getHour());
tvMinute.setText(getMinute());
// animacion en el separador de horas
set = (AnimatorSet) AnimatorInflater.loadAnimator(this, R.animator.ticker_tick);
set.setTarget(tvSeparator);
set.start();
}
示例5: beginAnimation
import android.animation.AnimatorInflater; //導入方法依賴的package包/類
private void beginAnimation() {
if (animId > 0) {
anim = AnimationUtils.loadAnimation(getContext(), animId);
startAnimation(anim);
}
if (animatorId > 0) {
animator = AnimatorInflater.loadAnimator(getContext(), animatorId);
animator.setTarget(this);
animator.start();
}
Drawable drawable = getDrawable();
if (drawable instanceof Animatable2) {
if (callback != null) {
((Animatable2) drawable).registerAnimationCallback(callback);
}
((Animatable2) drawable).start();
}
}
示例6: init
import android.animation.AnimatorInflater; //導入方法依賴的package包/類
private void init(Context context, AttributeSet attrs) {
setOrientation(LinearLayout.HORIZONTAL);
setGravity(Gravity.CENTER);
handleTypedArray(context, attrs);
mAnimationOut = AnimatorInflater.loadAnimator(context, mAnimatorResId);
if (mAnimatorReverseResId == -1) {
mAnimationIn = AnimatorInflater.loadAnimator(context, mAnimatorResId);
mAnimationIn.setInterpolator(new ReverseInterpolator());
} else {
mAnimationIn = AnimatorInflater.loadAnimator(context, mAnimatorReverseResId);
}
setPadding(0, dip2px(TEXT_SIZE + 8), 0, 0);
setBackgroundColor(0x00000000);
textPaint = new TextPaint();
textPaint.setColor(Color.WHITE);
textPaint.setAntiAlias(true);
textPaint.setTextSize(dip2px(TEXT_SIZE));
textPaint.setTextAlign(Paint.Align.CENTER);
}
示例7: checkIndicatorConfig
import android.animation.AnimatorInflater; //導入方法依賴的package包/類
private void checkIndicatorConfig(Context context) {
mIndicatorWidth = (mIndicatorWidth < 0) ? dip2px(DEFAULT_INDICATOR_WIDTH) : mIndicatorWidth;
mIndicatorHeight =
(mIndicatorHeight < 0) ? dip2px(DEFAULT_INDICATOR_WIDTH) : mIndicatorHeight;
mIndicatorMargin =
(mIndicatorMargin < 0) ? dip2px(DEFAULT_INDICATOR_WIDTH) : mIndicatorMargin;
mAnimatorResId = (mAnimatorResId == 0) ? R.animator.scale_with_alpha : mAnimatorResId;
mAnimationOut = AnimatorInflater.loadAnimator(context, mAnimatorResId);
if (mAnimatorReverseResId == 0) {
mAnimationIn = AnimatorInflater.loadAnimator(context, mAnimatorResId);
mAnimationIn.setInterpolator(new ReverseInterpolator());
} else {
mAnimationIn = AnimatorInflater.loadAnimator(context, mAnimatorReverseResId);
}
mIndicatorBackgroundResId = (mIndicatorBackgroundResId == 0) ? R.drawable.white_radius
: mIndicatorBackgroundResId;
mIndicatorUnselectedBackgroundResId =
(mIndicatorUnselectedBackgroundResId == 0) ? mIndicatorBackgroundResId
: mIndicatorUnselectedBackgroundResId;
}
示例8: createAnimator
import android.animation.AnimatorInflater; //導入方法依賴的package包/類
private Animator createAnimator(int sidePanelAnimResId, int sidePanelGridAnimResId,
int tableAnimResId) {
List<Animator> animatorList = new ArrayList<>();
Animator sidePanelAnimator = AnimatorInflater.loadAnimator(mActivity, sidePanelAnimResId);
sidePanelAnimator.setTarget(mSidePanel);
animatorList.add(sidePanelAnimator);
if (sidePanelGridAnimResId != 0) {
Animator sidePanelGridAnimator = AnimatorInflater.loadAnimator(mActivity,
sidePanelGridAnimResId);
sidePanelGridAnimator.setTarget(mSidePanelGridView);
sidePanelGridAnimator.addListener(
new HardwareLayerAnimatorListenerAdapter(mSidePanelGridView));
animatorList.add(sidePanelGridAnimator);
}
Animator tableAnimator = AnimatorInflater.loadAnimator(mActivity, tableAnimResId);
tableAnimator.setTarget(mTable);
tableAnimator.addListener(new HardwareLayerAnimatorListenerAdapter(mTable));
animatorList.add(tableAnimator);
AnimatorSet set = new AnimatorSet();
set.playTogether(animatorList);
return set;
}
示例9: onFinishInflate
import android.animation.AnimatorInflater; //導入方法依賴的package包/類
@Override
protected void onFinishInflate() {
super.onFinishInflate();
mContainerView = findViewById(R.id.block_screen_container);
mImageContainer = findViewById(R.id.image_container);
mNormalImageView = (ImageView) findViewById(R.id.block_screen_icon);
mShrunkenImageView = (ImageView) findViewById(R.id.block_screen_shrunken_icon);
mSpace = findViewById(R.id.space);
mTextView = (TextView) findViewById(R.id.block_screen_text);
mFadeIn = AnimatorInflater.loadAnimator(getContext(),
R.animator.tvview_block_screen_fade_in);
mFadeIn.setTarget(mContainerView);
mFadeOut = AnimatorInflater.loadAnimator(getContext(),
R.animator.tvview_block_screen_fade_out);
mFadeOut.setTarget(mContainerView);
mFadeOut.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mContainerView.setVisibility(GONE);
mContainerView.setAlpha(1f);
}
});
}
示例10: animateContainer
import android.animation.AnimatorInflater; //導入方法依賴的package包/類
void animateContainer(final View container, final boolean dismiss) {
container.setVisibility(View.VISIBLE);
Animator animator = dismiss ? AnimatorInflater.loadAnimator(this, R.animator.exit_to_left) :
AnimatorInflater.loadAnimator(this, R.animator.enter_from_right);
animator.setTarget(container);
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (dismiss) {
container.setVisibility(View.GONE);
UIUtils.dismissKeyboard(LWQSettingsActivity.this);
} else {
UIUtils.revealKeyboard(container == addEditQuote ? editableQuote : editableQuery);
}
}
});
animator.start();
}
示例11: checkIndicatorConfig
import android.animation.AnimatorInflater; //導入方法依賴的package包/類
private void checkIndicatorConfig(Context context) {
mIndicatorWidth = (mIndicatorWidth < 0) ? dip2px(DEFAULT_INDICATOR_WIDTH) : mIndicatorWidth;
mIndicatorHeight =
(mIndicatorHeight < 0) ? dip2px(DEFAULT_INDICATOR_WIDTH) : mIndicatorHeight;
mIndicatorMargin =
(mIndicatorMargin < 0) ? dip2px(DEFAULT_INDICATOR_WIDTH) : mIndicatorMargin;
mAnimatorResId = (mAnimatorResId == 0) ? R.animator.scale_with_alpha : mAnimatorResId;
mAnimationOut = AnimatorInflater.loadAnimator(context, mAnimatorResId);
if (mAnimatorReverseResId == 0) {
mAnimationIn = AnimatorInflater.loadAnimator(context, mAnimatorResId);
mAnimationIn.setInterpolator(new ReverseInterpolator());
} else {
mAnimationIn = AnimatorInflater.loadAnimator(context, mAnimatorReverseResId);
}
mIndicatorBackgroundResId = (mIndicatorBackgroundResId == 0) ? R.drawable.white_radius
: mIndicatorBackgroundResId;
mIndicatorUnselectedBackgroundResId =
(mIndicatorUnselectedBackgroundResId == 0) ? mIndicatorBackgroundResId
: mIndicatorUnselectedBackgroundResId;
}
示例12: initAnim
import android.animation.AnimatorInflater; //導入方法依賴的package包/類
/**
* 初始化動畫
*/
private void initAnim() {
Animator card_flip_left_out = AnimatorInflater.loadAnimator(getContext(), R.animator.card_flip_left_out);
card_flip_left_out.setTarget(mForegroundView);
Animator card_flip_left_in = AnimatorInflater.loadAnimator(getContext(), R.animator.card_flip_left_in);
card_flip_left_in.setTarget(mBackgroundView);
mLeftSet = new AnimatorSet();
mLeftSet.playTogether(card_flip_left_out, card_flip_left_in);
Animator card_flip_right_out = AnimatorInflater.loadAnimator(getContext(), R.animator.card_flip_right_out);
card_flip_right_out.setTarget(mBackgroundView);
Animator card_flip_right_in = AnimatorInflater.loadAnimator(getContext(), R.animator.card_flip_right_in);
card_flip_right_in.setTarget(mForegroundView);
mRightSet = new AnimatorSet();
mRightSet.playTogether(card_flip_right_out, card_flip_right_in);
}
示例13: defineValueAnimatorTests
import android.animation.AnimatorInflater; //導入方法依賴的package包/類
private static void defineValueAnimatorTests(TestActivity act, View rootView,InflatedLayout layout)
{
final TextView textView = (TextView) rootView.findViewById(R.id.valueAnimatorTestId1);
ValueAnimator valueAnimator;
if (layout == null)
valueAnimator = (ValueAnimator)AnimatorInflater.loadAnimator(act,R.animator.test_value_animator_compiled);
else
valueAnimator = (ValueAnimator)layout.getItsNatResources().getAnimator("@assets:animator/res/animator/test_value_animator_asset.xml");
valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener()
{
public void onAnimationUpdate(ValueAnimator animation)
{
Integer value = (Integer) animation.getAnimatedValue();
textView.setBackgroundColor(value);
}
});
valueAnimator.start();
Assert.assertEquals(valueAnimator.getDuration(), 2000);
Assert.assertEquals(valueAnimator.getRepeatCount(), -1);
Assert.assertEquals(valueAnimator.getRepeatMode(), 2);
Assert.assertEquals(valueAnimator.getStartDelay(), 10);
}
示例14: registerAnimators
import android.animation.AnimatorInflater; //導入方法依賴的package包/類
@Override
protected void registerAnimators() {
mElevateAnimator = AnimatorInflater.loadAnimator(mContext, R.animator.elevate);
mElevateAnimator.addListener(this);
mElevateAnimator.setTarget(mView);
mElevateAnimator.setDuration(500);
mFlipLeftOutAnimator = AnimatorInflater.loadAnimator(mContext, R.animator.flip_left_out);
mFlipLeftOutAnimator.addListener(this);
mFlipLeftOutAnimator.setTarget(mView);
mFlipLeftInAnimator = AnimatorInflater.loadAnimator(mContext, R.animator.flip_left_in);
mFlipLeftInAnimator.addListener(this);
mFlipLeftInAnimator.setTarget(mView);
mLowerAnimator = AnimatorInflater.loadAnimator(mContext, R.animator.lower);
mLowerAnimator.addListener(this);
mLowerAnimator.setTarget(mView);
mLowerAnimator.setDuration(500);
}
示例15: doAnimationToGridLayout
import android.animation.AnimatorInflater; //導入方法依賴的package包/類
/** GridLayout のアニメーション */
private void doAnimationToGridLayout() {
for (int i = 0, iL = mGridLayout.getChildCount(); i < iL; i++) {
// 左上を基準として、距離を計算する。
int vi = i % mGridLayout.getColumnCount();
int hi = i / mGridLayout.getRowCount();
int dist = vi + hi;
// childを読み込み
View childAt = mGridLayout.getChildAt(i);
// アニメーション読み込み、設定
Animator anim = (isShowingGridLayout)
? AnimatorInflater.loadAnimator(this, R.animator.activity_property_animation_grid_hide)
: AnimatorInflater.loadAnimator(this, R.animator.activity_property_animation_grid_show);
anim.setTarget(childAt);
anim.setStartDelay(dist * 60);
anim.start();
}
isShowingGridLayout = !isShowingGridLayout;
}