I am trying to place a button overlapping two layouts. The Layouts must have the layout_weight as shown in the image below, I've been struggling on it for a while, .. I succeeded with the below code .. but only for api 22 (lollipop) & 23 (MarshMallow).. Problem occurs in API 19 (Kitkat) & below .. The Lower layout seem to cover the button .. ie, button is half visible from the top.
Please help me to achieve like in image with all android version support .. TIA !
Code which worked on API 22 & 23 but not in 19 and Below:
<?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"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.automovill.automovill.testing">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="1">
<LinearLayout
android:id="@+id/LL1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight=".55"
android:background="#2961a7"
android:orientation="vertical">
</LinearLayout>
<Button
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginTop="-25dp"
android:background="#ffd016"
android:padding="10dp"
android:text="TESTING"
android:textColor="#000"
android:textStyle="bold" />
<RelativeLayout
android:id="@+id/LL2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="-25dp"
android:layout_weight=".45"
android:background="#163d6d">
</RelativeLayout>
</LinearLayout>