How to use gif on Android?

0

I've tried to use GIF in ImageView , but it does not work, is there any way to get Android to accept GIF images?

    
asked by anonymous 03.04.2017 / 06:32

1 answer

2

There are some possible ways to do this. One of them, that would be the easy way, is you import a module already ready, such as android-gif-drawable . Even though it is already in the documentation, here is 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>
    
03.04.2017 / 07:03