Search code examples
androidoverlayandroid-relativelayout

How do I overlap my view


I am new to android and I need to overlap a circle kind of image on head of box . How do i do it .

Below is my code .

<RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
              android:layout_centerInParent="true"
            android:layout_marginBottom="80dp"
            android:layout_alignBottom="@+id/farmerSearchLinearLayout"
            android:src="@drawable/upload_pic" />




    <LinearLayout
        android:id="@+id/farmerSearchLinearLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="20dp"
        android:layout_marginLeft="20dp"
        android:layout_marginRight="20dp"
        android:layout_marginTop="20dp"
        android:background="@drawable/box1"
        android:orientation="vertical"
        android:padding="20dp" >

        <RelativeLayout
            android:id="@+id/RelativeLayout1"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:orientation="horizontal" >

            <ImageView
                android:id="@+id/image1"
                android:layout_width="wrap_content"
                android:layout_height="80dp"
                android:layout_centerInParent="true"
                android:src="@drawable/field" />

            <ImageView
                android:id="@+id/searchClickImg"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignRight="@+id/image1"
                android:layout_centerInParent="true"
                android:src="@drawable/click" />

            <TextView
                android:id="@+id/farmerNameTxtView"
                android:layout_width="200dp"
                android:layout_height="wrap_content"
                android:layout_alignLeft="@+id/image1"
                android:layout_centerVertical="true"
                android:layout_marginLeft="61dp"
                android:ellipsize="none"
                android:scrollHorizontally="false"
                android:text="Farmer Name"
                android:textColor="#333333"
                android:textSize="13sp" />

            <EditText
                android:id="@+id/codeSearchEditTxt"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentTop="true"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="40dp"
                android:layout_marginTop="22dp"
                android:layout_toLeftOf="@+id/searchClickImg"
                android:hint="Enter Farmer Code"
                android:textColor="#b40e5b"
                android:textSize="16sp" />
        </RelativeLayout>

        <TextView
            android:id="@+id/addressTxtView"
            android:layout_width="400dp"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:gravity="center"
            android:text="Address"
            android:textColor="#333333"
            android:textSize="13sp" />
    </LinearLayout>

    </RelativeLayout>

I need to overlap upload_pic (small round circle pic )image from ImageView on LinearLayout which consist of a box . I need half Image outtside the box at center and above the box image


Solution

  • Use Frame layout: [Android Use Frame Layout for Overlapping Items] http://davehiren.blogspot.in/2014/04/android-use-framelayout-for-overlapping.html