How to use gif on Android?

Asked

Viewed 297 times

0

I’ve tried using GIF on ImageView , but it doesn’t work , has some way to make Android accept GIF images?

  • https://github.com/Cutta/GifView

1 answer

2


There are a few possible ways to do this. One of them, which would be the easy way, is to import a ready-made module, as for example android-gif-drawable. Even though it is already in the documentation, see below an example of use:

Gradle

dependencies {
    compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.+'
}

XML

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <pl.droidsonroids.gif.GifTextView
        android:layout_width="match_parent"
        android:layout_height="100dp"
        android:background="@drawable/soud"
        android:layout_weight="0.60" />

</LinearLayout>

Browser other questions tagged

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