How to display .gif file in imageview?

后端 未结 8 1740
无人及你
无人及你 2020-12-13 20:26

My layout have lots of imageviews. I want to show .gif animated file in just one imageview. I tried Yash method (Adding gif image in an ImageView in android) but .gif file s

8条回答
  •  醉梦人生
    2020-12-13 21:21

    Best and easiest solution to display GIF image in Android and it will work perfectly:

    • Open build.gradle (Module: app)
    • put in dependencies: compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.+'
    • Open layout folder and put this code where you want to display GIF image: e-g activity_main.xml

       
      
    • android:src="@drawable/your_gif_file_name", Replace 'your_gif_file_name' with your desired gif image file

提交回复
热议问题