I am trying to create a layout as follows:

Two views with a weight of 2 (green view) and 1 (blue view) in a linear layout. And a floating button located between these views opposite them. But this is not possible using a linear layout. Can anyone help a little here.
Update: Here is what I did
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
android:background="#22B14C" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="To be a floating button" />
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#00A2E8" />
</LinearLayout>
And i have

Samir source
share