2

I need to create a layout as shown in the image. The rounded button with the arrow needs to be exactly between the blue and the gray background. I'm having difficulties placing it without specifying the margins precisely, which is something I don't want to do because there is no guarantee it will look good on all resolutions and devices. I would appreciate an xml sample for that

Thanks! enter image description here

Orr
  • 4,740
  • 3
  • 28
  • 31
  • possible duplicate of [Place view on top and between two views](http://stackoverflow.com/questions/16616376/place-view-on-top-and-between-two-views) – Voicu Oct 26 '14 at 22:10

1 Answers1

2

Screenshot

Use the desired drawable.. hope it works.. you can set width and height according to your need.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical" >

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="0dip"
                android:layout_weight="1"
                android:background="#1b96d9"
                android:orientation="vertical" >
            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_weight="1"
                android:background="#e6e6e6"
                android:orientation="vertical" >
            </LinearLayout>
        </LinearLayout>

        <ImageView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:src="@drawable/arrow" />
    </FrameLayout>

</LinearLayout>
Dhinakaran Thennarasu
  • 3,336
  • 4
  • 26
  • 39
  • 1
    what if the layouts have weight of 3 and 7 . how do you keep the arrow at the exact intersection of two layouts ? – Sagar Nayak Sep 10 '16 at 07:59