在android上隐藏动画结果
我使用“平移动画”隐藏活动中的底部布局在android上隐藏动画结果,android,animation,android-ui,Android,Animation,Android Ui,我使用“平移动画”隐藏活动中的底部布局 translate> xmlns:android="http://schemas.android.com/apk/res/android" android:fillEnabled="true" android:fillAfter="true" android:fromXDelta="0" android:toXDelta="0" android:fromYDelta="0" android:to
translate>
xmlns:android="http://schemas.android.com/apk/res/android"
android:fillEnabled="true"
android:fillAfter="true"
android:fromXDelta="0"
android:toXDelta="0"
android:fromYDelta="0"
android:toYDelta="100%"
android:duration="300">
</translate>
hideAnimation = AnimationUtils.loadAnimation(this, R.anim.bottom_bar_animation);
imageTitleLayout.startAnimation(hideAnimation);
因此,如果我的视图隐藏在横向模式下,它只会降低屏幕,而不会显示。
但当我将设备的方向更改为纵向时,我可以看到靠近屏幕中心的底部布局。
.setVisibility(View.GONE)不起作用,因为我们看到的不是视图,而是动画的结果
隐藏视图的方法是:
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
Animation fadeOut = new AlphaAnimation(1.00f, 0.00f);
fadeOut.setDuration(1);
imageTitleLayout.startAnimation(fadeOut);
}
但是代码看起来很难看。
有没有更好的方法隐藏动画的结果?我正在寻找View.clearAnimation()方法
基本上只需调用
View.clearAnimation()
即可去除动画结果图像。您可以回答自己的问题,但有关这是如何回答的详细信息会有所帮助。
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
Animation fadeOut = new AlphaAnimation(1.00f, 0.00f);
fadeOut.setDuration(1);
imageTitleLayout.startAnimation(fadeOut);
}