Question: [![enter image description here](https://i.stack.imgur.com/fLHiH.png)](https://i.stack.imgur.com/fLHiH.png)
this is my image i have used card view to display item in recyclerview view . Below is xml

```
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:card_view="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">   
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">
    <TextView
        android:id="@+id/cardTicketName"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="center"
        android:gravity="center"
        android:text="Here will be the text"
        android:textColor="#484848"
        android:padding="20dp"
        android:textSize="15dp" />
    </LinearLayout>
</android.support.v7.widget.CardView>

```

that below item bottom shadow is more than top shadow and also same problem happening when we scroll top item to bottom then shadow increase of bottom and when again scroll to top same item its shadow effect decrees 

how to fix this issue?

Answer: 
I faced the same issue recently and this is the default behavior as [Ben P.](https://stackoverflow.com/users/8298909/ben-p) said. Also, there is a more [detailed explanation](https://stackoverflow.com/questions/32534578/cardview-dynamic-shadow-depends-not-only-on-elevation).

Usually, it's not recommended to fight against system behavior. But if you need so - there is a simple way how to do it:

You can use [MaterialShapeDrawable](https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable) from the official [Material Components library](https://material.io/develop/android/docs/getting-started) (which is really [powerful](https://medium.com/ackee/create-beautiful-shapes-with-materialshapedrawable-874dd46e0fd5)) for your view's background. It has `shadowCompatibilityMode` property - you can set it to `MaterialShapeDrawable.SHADOW_COMPAT_MODE_ALWAYS` and it will draw fake shadow instead of a native one. It could look like this:

```none
MaterialShapeDrawable().apply {
            shadowCompatibilityMode = MaterialShapeDrawable.SHADOW_COMPAT_MODE_ALWAYS  // fake shadow instead of native one
            setShadowColor(shadowColor) // you also can define shadow color
            elevation = 4F
            paintStyle = Paint.Style.FILL
}

```

As result you will have fixed shadow, no matter where is your view on the screen
The Android framework uses a combination of two simulated light sources to create shadow effects. One of these is a general ambient light, so that everything with elevation casts a little bit of shadow on all sides. The other, however, is a simulated point light near the top of the screen.

This point light's position means that bottom shadows are always larger than top shadows. It also means that bottom shadows near the bottom of the screen are always larger than bottom shadows near the top of the screen.

There is no way to disable this behavior. If you want to use Android's built-in elevation/shadow framework, this is how it works.

You can simulate your own shadows by doing custom drawing or by using a gradient with semi-transparent black, but you will find both of these significantly more difficult than simply accepting that this is how shadows work and this is what users are expecting.

<https://material.io/design/environment/light-shadows.html>