Posts with the tag xml:

Adding GIF image in an ImageView in android

use android-gif-drawable library add the following dependency to build.gradle file of your project. dependencies { implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.19' } Use the view in XML file like this. <pl.droidsonroids.gif.GifImageView android:layout_width="match_parent" android:layout_height="match_parent" android:src="@drawable/src_anim" android:background="@drawable/bg_anim" /> For more customization and code, see the docs here. use VideoView on Android You can use VideoView to show the GIF image. But the library is more efficient and smooth. use ImageView on Android Use ImageView and Split the GIF file into several images and then apply animation to it. It is complicated and not worth it because the library is more efficient and elegant. use Glide library add the dependency to build.

How to make imageview over another view in Android ?

There are at least 3 ways to put imageview on another imageview. Simple Order This way is just put the imageview after the other imageview in XML file. It is simple like that. The first view will be underneath the second one. Using FrameLayout <FrameLayout xmlns:android="" android:layout_width="wrap_content" android:layout_height="wrap_content" > <ImageView android:id="@+id/imageView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/t" /> <ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_launcher" /> </FrameLayout> The second image will be on top. Put imageview on another imageview exactly <RelativeLayout xmlns:android="" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@color/white" > <ImageView android:id="@+id/inside_imageview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="5dip" android:layout_marginTop="5dip" android:src="@drawable/frame" /> <ImageView android:id="@+id/outside_imageview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignTop="@id/inside_imageview" android:layout_alignBottom="@id/inside_imageview" android:layout_alignLeft="@id/inside_imageview" android:layout_alignRight="@id/inside_imageview" android:scaleType="fitXY" /> </RelativeLayout> As you can see, the second imageview has those properties.