Reputation: 111
I recently downloaded a gif image to insert it into my new Android Studio project. After downloading I copied the .gif file into the drawable folder. I called it "image". In the section "Text" of the activity_main layout I wrote this :
<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" />
In apparence there aren't problems... But when I start my app the gif doesn't work. It is static like a .jpg file image. What can I do to play my .gif image in the application on my Android mobile?
Upvotes: 1
Views: 582
Reputation: 345
well using a imageview will not do what your are trying to. there are several methods to view gifs though.example link or you might simply like to use a library.
Upvotes: 1