Have recycler with CardView
items. When screen open - I start alpha animation on recycler :
recyclerView.animate().alpha(1f).setStartDelay(300).start()
Recycler item:
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="6dp"
android:layout_marginEnd="20dp"
android:layout_marginBottom="6dp"
app:cardCornerRadius="10dp"
app:cardElevation="4dp">
...
</android.support.v7.widget.CardView>
Problem that while this animation running the shadow of CardView
directed to the up but when animation ends shadow change direction to the bottom (as normal)
Problem was found only on Android 9.
P.S. sorry for my english)
Found a workaround. Make sure the alpha-animation targets on CardView itself instead of its parent and its parent's alpha must be 1F. This work in my case. Hope it can help you too.
I have found a partial fix,
If you add android:layerType="hardware" to the parent view the shadow no longer flips direction.
The down side is the shadow permanently points in the wrong direction.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With