Can I set the blue view in the center of the black layout Knowing that the black layout is it's parent of parent
like in the image
Can I set the blue view in the center of the black layout Knowing that the black layout is it's parent of parent
like in the image
You have to change things around a bit, you can't put a view relative to a parent's parent.
You need a RelativeLayout as the root layout, and then you place the blue line centered vertically. Then you would place the red LinearLayouts above and below the blue layout. Something like this:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<View
android:id="@+id/blue_layout"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_centerVertical="true"
android:background="#ff0000ff" />
<LinearLayout
android:id="@+id/above"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@id/blue_layout"
android:orientation="vertical">
</LinearLayout>
<LinearLayout
android:id="@+id/below"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/blue_layout"
android:orientation="vertical">
</LinearLayout>
</RelativeLayout>