【问题标题】:Hide animation result on android在android上隐藏动画结果
【发布时间】:2017-06-19 16:47:53
【问题描述】:

我使用翻译动画来隐藏活动中的底部布局。

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);

活动有

android:configChanges="orientation". 

因此,如果我的视图隐藏在横向模式下,它只会降低屏幕并且不会显示。 但是当我将设备的方向更改为纵向时,我可以看到靠近屏幕中心的底部布局。 .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);
}

但是代码看起来很丑。 有没有更好的方法来隐藏动画的结果?

【问题讨论】:

    标签: android animation android-ui


    【解决方案1】:

    我在寻找 View.clearAnimation() 方法。

    基本上只需调用View.clearAnimation() 即可摆脱动画结果图像。

    【讨论】:

    • 你可以回答你自己的问题,但更多关于如何回答的细节会有所帮助。
    猜你喜欢
    • 2021-06-19
    • 2016-09-06
    • 2013-09-18
    • 1970-01-01
    • 2022-01-02
    • 2013-12-22
    • 1970-01-01
    • 2011-10-27
    • 1970-01-01
    相关资源
    最近更新 更多