I am trying to position a button in between two layouts.
Also, I don't want to have to do this with a margin if I can help it, when you start dealing with different screen sizes margin breaks down.
(In this image, I am trying to position the green button in between two layouts)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:background="@color/busy_white">
<LinearLayout
android:orientation="vertical"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:gravity="center">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/profile_default_round"
android:background="@drawable/ring_status_clock_in"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="John Doe"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Manager"/>
</LinearLayout>
<RelativeLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@color/translucent_black_90"
android:padding="16dp">
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_alignParentLeft="true">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Today Total"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="08:32"/>
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:layout_alignParentRight="true">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Week Total"
android:gravity="right"/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="24:32"
android:gravity="center"/>
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="-40dp">
</LinearLayout>
</RelativeLayout>
<include layout="@layout/dashboard_clock_in_button" />
</LinearLayout>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…