I am displaying a GIF image in android using Glide library. My only issue is my Gif image has a white background like this My screen, the gif I have downloaded is from this link The Gif image. My issue is there is white colour at the background of the gif image as you can see in the screen. I want it to be black as my layout background is black. Below is my layout file activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black"
>
<ImageView
android:id="@+id/imageGif"
android:layout_width="128dp"
android:layout_height="128dp"
android:src="@drawable/finger1" />
</RelativeLayout>
Below is the MainActivity.kt class code
import android.os.Bundle
import android.widget.ImageView
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import com.bumptech.glide.Glide
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val imageView = findViewById<ImageView>(R.id.imageGif)
Glide.with(this).asGif().load(R.drawable.finger1).into(imageView)
}
}
I tried to add android:color/transparent property in the Imageview but the result is same. I want the background colour to match background colour of layout file [similar to how it happens when when we put png image or jpeg image)
2