实际上就是复写一下descriptionAnimation的onNextItemAppear方法
创建一个新的类使用接口BaseAnimationInterface
主要是把setVisibility(View.INVISIBLE) 修改成 setVisibility(View.GONE)
@Override
public void onNextItemAppear(View view) {
View descriptionLayout = view.findViewById(R.id.description_layout);
if(descriptionLayout!=null){
float layoutY = ViewHelper.getY(descriptionLayout);
view.findViewById(R.id.description_layout).setVisibility(View.GONE);
ValueAnimator animator = ObjectAnimator.ofFloat(
descriptionLayout,"y",layoutY + descriptionLayout.getHeight(),
layoutY).setDuration(500);
animator.start();
}
}
然后在activity里设置自定义动画就可以啦
// 设置TextView自定义动画
sliderShow.setCustomAnimation(new ChildAnimationExample());
![1586098253122535.png image.png](/ueditor/php/upload/image/20200405/1586098253122535.png)