我正在尝试让一个简单的视图在另一个视图后面滑动消失,我尝试过任何类型的动画,但没有一个成功..
这是我迄今为止尝试过的:
public void slideToTop(View view){
TranslateAnimation animate = new TranslateAnimation(0,0,0,-view.getHeight());
animate.setDuration(1000);
view.startAnimation(animate);
view.setVisibility(View.GONE);
}
有和没有 ReverseInterpolator
public class ReverseInterpolator implements Interpolator {
public float getInterpolation(float paramFloat) {
return Math.abs(paramFloat -1f);
}
}
或缩放
public void scaling(View view) {
ScaleAnimation animation = new ScaleAnimation(0,0,1,1.5f);
animation.setDuration(1000);
animation.setFillAfter(true);
view.startAnimation(animation);
}
或使用新的 api
editView.animate().translationY(-editView.getHeight()).withLayer();
关于如何实现这一目标的任何帮助?
我的布局是这样的:
<ScrollView>
<LinearLayout>
<LinearLayout>
<TextView/>
<View/> <!-- This should "disappear" sliding up behind the other one -->
</LinearLayout>
<!-- more of the previous -->
<LinearLayout>
<TextView/>
<View/>
</LinearLayout>
</LinearLayout>
</ScrollView>
有什么帮助吗?谢谢!