Comme l'iPhone, je veux définir une animation gif comme arrière-plan pour la mise en page Android. c'est possible? Si oui, quelqu'un partagera volontiers vos connaissances.Animation Gif comme arrière-plan pour une mise en page
Merci!
Comme l'iPhone, je veux définir une animation gif comme arrière-plan pour la mise en page Android. c'est possible? Si oui, quelqu'un partagera volontiers vos connaissances.Animation Gif comme arrière-plan pour une mise en page
Merci!
Oui, c'est possible et aussi très simple. D'abord, vous définissez ou déclarez la disposition principale: RelativeLayout
, puis définissez la disposition requise dans cette mise en page principale. La hauteur et la largeur sont match_parent
. Après avoir défini le code XML de votre fichier gif qui se trouve en dehors de la mise en page interne et à l'intérieur de la mise en page principale.
Quelque chose comme ceci:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
*********** here you create your GUI layout *********
</RelativeLayout>
*************** Here your gif file xml code, here i'm using ex. lib ***********
<pl.droidsonroids.gif.GifTextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/butterflyanimation"
android:layout_margin="15dp"
android:layout_centerInParent="true"/>
</RelativeLayout>
ici, je me sers d'un lib tiers pour charger le fichier GIF et il est le chemin de compilation est
compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.+'
Vous devez probablement expliquer d'où provient pl.droidsonroids.gif.GifTextView car il ne fait pas partie du SDK Android. – Cheesebaron
ya c'est la troisième partie lib –
utilisation https://github.com/koral -/android-gif-drawable ou https://github.com/Cutta/GifView – Nepster