How to place an imageview on top of another imageview in android

Viewed 63922

This is my layout which i tried so far without any success

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/white">

 <LinearLayout 
    android:id="@+id/lltest" 
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:layout_centerHorizontal="true">

        <ImageView 
        android:id="@+id/inside_imageview" 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" 
        android:layout_marginTop="5dip"
        android:layout_marginBottom="5dip"
        android:src="@drawable/frame"/>

</LinearLayout>

 <ImageView 
        android:id="@+id/outside_imageview" 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" 
        android:layout_alignTop="@id/inside_imageview"
        android:scaleType="fitXY"/>
</RelativeLayout>

What i exactly want is to have my outside_imageview on top of inside_imageview with the exact height and width... How to do it through layout?

7 Answers

I use Elevation only... 0=floor or basement ... lol 1=floor2 10=floor10 the top top

    <ImageView
          android:id="@+id/blog_user_image_gp"
          android:layout_width="match_parent"
          android:layout_height="200dp"
          android:layout_marginTop="70dp"
          android:src="@drawable/avatar"
          android:scaleType="fitXY"
          android:foregroundGravity="center"
          android:elevation="10dp"
          />
  <android.support.v7.widget.RecyclerView
        android:id="@+id/users_list"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="80dp"
        android:elevation="1dp"
        android:scrollbars="vertical" />
Related