-1
私は開いた/閉じて、同時に伸縮するスライド式の引き出しアニメーションを作成しました。私はValueAnimatorとAnimatorUpdateListenerの内部を使用しています。ビューのマージンを操作して、サイズを拡大または縮小(拡大/縮小)しています。同時に、開閉はValueAnimatorによって処理されます。ギャラクシーメガ2の携帯電話の場合、このアニメーションは非常に不安定です。まったく滑らかではありません。他のすべての電話は、古いものと新しいものがうまく動作しているようです。これが解決できる方法はありますか?アニメーションはギャラクシーメガ2の電話機にしか適用されません
// close drawer
ValueAnimator animator = ValueAnimator.ofInt(0, 100);
animator.setInterpolator(new AccelerateInterpolator());
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
float ratio = ((Integer) animation.getAnimatedValue()/100);
// moves the drawer to the left and reduces its size by changing its margins
mDrawerParams.setMargins((int) (mLeftMargin * ratio), (Integer) animation.getAnimatedValue(),
0, (Integer) animation.getAnimatedValue());
rlDrawer.setLayoutParams(mDrawerParams);
}
そして、ここであなたがlayoutParamsを変更した場合、私は私の引き出し
// open drawer
ValueAnimator animator = ValueAnimator.ofInt(100, 0);
animator.setInterpolator(new AccelerateInterpolator());
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
float ratio = ((Integer) animation.getAnimatedValue()/100);
// moves the drawer to the right and increases its size by changing its margins
mDrawerParams.setMargins((int) (mLeftMargin * ratio), (Integer) animation.getAnimatedValue(),
0, (Integer) animation.getAnimatedValue());
rlDrawer.setLayoutParams(mDrawerParams);
}