user7624048
user7624048

Reputation:

How to show Gif image in Glide on Android

I want show Gif image in Glide library. I write below codes but when show my gif, show very very slow motion . i want show gif normally bit rate not slow motion.

ImageView test = (ImageView) findViewById(R.id.testImageGif);
GlideDrawableImageViewTarget imageViewTarget = new GlideDrawableImageViewTarget(test);
Glide.with(this)
        .load(R.drawable.login_image)
        .into(imageViewTarget);

how can it?

Upvotes: 2

Views: 1289

Answers (2)

Hila Grossbard
Hila Grossbard

Reputation: 612

as @SachinThampan said Here

Xml:

<ImageView
                android:id="@+id/title_gif"
                android:layout_width="@dimen/gif_width"
                android:layout_height="@dimen/gif_height"
                />

Java:

    ImageView imageView = (ImageView) findViewById(R.id.title_gif);
    Glide.with(this).asGif().load(R.raw.animated_gif).into(imageView);

In build.gradle:

implementation 'com.github.bumptech.glide:glide:4.0.0'

Upvotes: 0

Darish
Darish

Reputation: 11481

try this

ImageView test = (ImageView) findViewById(R.id.testImageGif);
    Glide  
    .with(this)
    .load(R.drawable.login_image)
    .asGif()
    .into(test);

Upvotes: 1

Related Questions