@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.product_item_top_rl:
startAnimation(v);
break;
}
}
private void startAnimation(final View v) {
int height = v.getHeight();
ValueAnimator va = ValueAnimator.ofInt(0, height);
va.setDuration(1000);
va.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
public void onAnimationUpdate(ValueAnimator animation) {
Log.d(TAG, "animation : " + animation.getAnimatedValue());
v.getLayoutParams().height = (Integer) animation.getAnimatedValue();
v.requestLayout();
}
});
va.start();
}
D/ChooseProductFragment: animation : 150
D/ChooseProductFragment: animation : 150
Problem solved. It's because yesterday, in order to use espresso for UI automation testing, I turned off the three animations "Window Animation Scaling", "Excessive Animation Scaling", and "Animation Program Duration Adjustment" in the settings. Re-enable these animations and it will be normal.
You did not specify the number and method of looping the animation, you should add