I would like to reproduce the following UI in my Android app but I have few questions.
- I use a
RelativeLayout
- Each circle is an
ImageView
- Negative margin is used for CircleLeft and CircleRight
My attempt:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/CircleCenter"
android:layout_marginTop="120dp"
android:background="@drawable/CircleCenter"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/CircleLeft"
android:background="@drawable/CircleLeft"
android:layout_alignTop="@+id/CircleCenter"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="false"
android:layout_marginLeft="-70dp"
android:layout_marginTop="-20dp" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/CircleRight"
android:background="@drawable/CircleRight"
android:layout_alignTop="@+id/CircleCenter"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="false"
android:layout_alignParentStart="false"
android:layout_marginRight="-70dp"
android:layout_marginTop="-20dp" />
</RelativeLayout>
Question
I think it's not so bad, but there is one problem: how to have auto negative margin (with something like: marginRight = -(ImageView width/2) ?
Thanks!