片段事务期间错误的高程阴影

问题描述

我在容器中替换了两个片段。我的问题是在我用于事务的自定义动画期间的高程阴影。我将持续时间设置为两秒以正确查看它,并且在事务期间似乎只有来自环境光的阴影可见,并且仅在动画结束后才显示关键光阴影(参见 https://material.io/design/environment/light-shadows.html#light)。有大佬知道怎么处理吗?

这是一些源代码和视频

卡片视图布局

<androidx.cardview.widget.CardView
    android:id="@+id/card"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginBottom="@dimen/margin_8dp"        
    app:cardElevation="@dimen/elevation_4dp"
    app:cardCornerRadius="@dimen/corner_16dp">

交易代码

supportFragmentManager
    .beginTransaction()
    .setCustomAnimations(
        R.anim.fade_in,R.anim.fade_out,R.anim.fade_in,R.anim.fade_out
    ).replace(R.id.fragment_container,questionsFragment,"questions")
    .commit()

动画xml

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="2000">

    <alpha
        android:fromAlpha="0"
        android:toAlpha="1"
        android:interpolator="@android:anim/accelerate_decelerate_interpolator"/>
</set>

这是该问题的示例视频 https://www.youtube.com/watch?v=dUe1GT4dAFQ

提前致谢。

解决方法

尝试将动画持续时间从 2 秒减少到 500 毫秒或 1000 毫秒。

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...