怎么能让下面的view顶上来,LinearLayout布局,使用mTopView.setVisibility(View.GONE)下面的布局可以自动上移,为什么动画不可以?
private void hideViews() {
mTopView.setTranslationY(0);
mTopView.animate().translationY(-mTopView.getHeight())
.setInterpolator(new AccelerateInterpolator(2)).setStartDelay(50).setDuration(500).start();
}
Have you setVisibility(View.GONE) after executing the animation
By the way, I added an alpha effect to the view that needs to be hidden, so that it looks more natural.
Use attribute animation to change the view itself