I've searched this up many times, but couldn't find an answer which worked for me. So basically, my issue is that I get an image from a backend provider and should display it in the ImageView with an opacity gradient of 100% at the bottom and 0% at the top so the image behind it slowly shows up. Applying a transparent gradient overlay doesn't work since the pixels to be transparent are the actual image I get from the backend service. Any help or ideas would be appreciated! The UI is in XML not Compose
This is the xml for the view I want to add an opacity gradient to. The image comes as a bitmap variable I assign to it's background currently:
<ImageView
android:id="@+id/bottom_container_background"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_container_height"
android:adjustViewBounds="true"
android:alpha="0.7"
android:src="@drawable/cardview_gradient_shape"
app:layout_constraintBottom_toBottomOf="@+id/iv_epg"
app:layout_constraintEnd_toEndOf="@+id/iv_epg"
app:layout_constraintStart_toStartOf="@+id/iv_epg"
tools:src="@drawable/cardview_gradient_shape" />
val croppedBlurredThumbnail = BitmapDrawable(thumbnailBottomBackgroundBlurred)
cardLayout.bottom_container_background.background = croppedBlurredThumbnai
l