Gif as the background of an Activity

Asked

Viewed 49 times

0

I’m new to Android programming, and would like to add a GIF like background of a Activity. Do I have to do this through Java or with you through XML? I’m not getting through set a Gif.

1 answer

1

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 is 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 Gif or drawable and third your Imageview which in this case is its id.

Link from the lib: https://github.com/bumptech/glide

Browser other questions tagged

You are not signed in. Login or sign up in order to post.