Bạn đã đánh dấu giải pháp gần nhất. Đây là giải pháp chính xác. Tôi đã từng gặp vấn đề tương tự. Hy vọng câu trả lời này sẽ giúp người khác.
nhanh chóng ResizeAnimation
ResizeAnimation resizeAnimation = new ResizeAnimation(
view,
targetHeight,
startHeight
);
resizeAnimation.setDuration(duration);
view.startAnimation(resizeAnimation);
ResizeAnimation
lớp nên trông như thế này
public class ResizeAnimation extends Animation {
final int targetHeight;
View view;
int startHeight;
public ResizeAnimation(View view, int targetHeight, int startHeight) {
this.view = view;
this.targetHeight = targetHeight;
this.startHeight = startHeight;
}
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
int newHeight = (int) (startHeight + targetHeight * interpolatedTime);
//to support decent animation, change new heigt as Nico S. recommended in comments
//int newHeight = (int) (startHeight+(targetHeight - startHeight) * interpolatedTime);
view.getLayoutParams().height = newHeight;
view.requestLayout();
}
@Override
public void initialize(int width, int height, int parentWidth, int parentHeight) {
super.initialize(width, height, parentWidth, parentHeight);
}
@Override
public boolean willChangeBounds() {
return true;
}
}
Nguồn
2015-10-13 06:06:44
Kiểm tra ở đây cho mở rộng và giải pháp sụp đổ tôi đã làm: http://stackoverflow.com/questions/20973089/android-add-view-with-expand- hoạt ảnh mà không chớp mắt –
http://stackoverflow.com/a/8162779/5996106 Giải pháp tốt nhất –