Search code examples
androidviewandroid-imageview

Android:Put an image over another image


I have three ImageViews and i want 1 ImageView to be in the background and the other 2 images should be laying on that one. I cannot use any other view because the image is downloaded in the image form that cannot be set as Linear or Relative layout background.

FIRST IMAGE

enter image description here

THIS IS THE SECOND IMAGE WHAT I WANT ACTUALLY

enter image description here


Solution

  • You can try as below xml layout...

    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true" >
    
        <ImageView
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:background="@drawable/ic_launcher"
            android:scaleType="fitXY" />
    
        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginBottom="100dip"
            android:background="@drawable/ic_launcher" />
    
        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom|center_horizontal"
            android:layout_marginBottom="100dip"
            android:background="@drawable/ic_launcher" />
    
    </FrameLayout>