I'm new to Android programming, and would like to add a GIF as a background of a Activity
. Do I have to do this through Java or do I get XML directly? I am not able to set the Gif.
I'm new to Android programming, and would like to add a GIF as a background of a Activity
. Do I have to do this through Java or do I get XML directly? I am not able to set the Gif.
In Gradle add:
dependencies {
implementation 'com.github.bumptech.glide:glide:3.5.2'
}
Example in your Activity:
Glide.with(context).load("https://inthecheesefactory.com/uploads/source/glidepicasso/gifanimation2.gif") .into(idDoTeuImageView);
If it's in the drawable folder:
Glide.with(this).load(R.drawable.gifanimation2) // aqui é teu gif
.asGif().into(gif);
First context of your class, according to the url of the Gif or drawable and third your ImageView that in the case is the id of it.
Lib link: link