Reputation: 2375
I have an imageview at relative layout, but i want to overlap this imageview Between different layouts like this
here is my layout code
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".CircularProgressBar" >
<RelativeLayout
android:id="@+id/relativeLayout1"
android:layout_width="match_parent"
android:layout_height="140dp"
android:background="#000000" >
<ImageView
android:id="@+id/image"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_gravity="center"
android:layout_marginBottom="-30dp"
android:src="@drawable/ic_launcher" />
</RelativeLayout>
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="wrap_content"
android:layout_height="160dp"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="@+id/relativeLayout1"
android:baselineAligned="false" >
<RelativeLayout
android:layout_width="0dp"
android:layout_height="160dp"
android:layout_weight="1"
android:background="#1268a5" >
</RelativeLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="160dp"
android:layout_weight="1"
android:background="#1268a5" >
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
I have tried using this android:layout_marginBottom="-30dp" in imageview but still i am not able to overlap.
Upvotes: 0
Views: 788
Reputation: 4738
Be warned, your layout isn't flexible at all. But here if you really want:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".CircularProgressBar">
<RelativeLayout
android:id="@+id/relativeLayout1"
android:layout_width="match_parent"
android:layout_height="140dp"
android:background="#000000">
</RelativeLayout>
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="160dp"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="@+id/relativeLayout1"
android:baselineAligned="false">
<RelativeLayout
android:layout_width="0dp"
android:layout_height="160dp"
android:layout_weight="1"
android:background="#1268a5">
</RelativeLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="160dp"
android:layout_weight="1"
android:background="#1268a5">
</RelativeLayout>
</LinearLayout>
<ImageView
android:id="@+id/image"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_alignBottom="@id/relativeLayout1"
android:layout_centerHorizontal="true"
android:layout_marginBottom="-30dp"
android:src="@drawable/ic_launcher"/>
</RelativeLayout>
Upvotes: 2