在Android Studio项目上运行gifImageView

时间:2017-05-26 14:16:34

标签: android android-studio imageview gif

我最近下载了一个gif图片,将其插入到我的新Android Studio项目中。下载后,我将.gif文件复制到drawable文件夹中。我称之为“形象”。在activity_main布局的“Text”部分,我写了这个:

<ImageView
        android:id="@+id/imageView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:srcCompat="@drawable/image"
        app:layout_constraintTop_toTopOf="parent"
        android:layout_marginTop="8dp"
        app:layout_constraintBottom_toBottomOf="parent"
        android:layout_marginBottom="8dp"
        app:layout_constraintVertical_bias="0.498"
        android:layout_marginRight="8dp"
        app:layout_constraintRight_toRightOf="parent"
        android:layout_marginLeft="8dp"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintHorizontal_bias="0.595" />

在表面上没有问题...但是当我启动我的应用程序时,gif不起作用。它像.jpg文件图像一样是静态的。如何在我的Android手机上的应用程序中播放我的.gif图像?

1 个答案:

答案 0 :(得分:1)

好好使用imageview不会做你想做的事情。有几种方法可以查看GIF。example link或者您可能只想使用library