I have the following code which is written programmatically,
Display display = this.WindowManager.DefaultDisplay;
Point size = new Point();
int height = size.Y;
bViewLayout.Height = (int)(height * 0.5);
However, I wonder how I could achieve half of the screen in Xml rather than hard coded as follows?
<GridLayout
android:layout_columnSpan="1"
android:layout_gravity="fill"
android:layout_rowSpan="1"
android:layout_height="135"/>
EDITED: The following code did not work:
<?xml version="1.0" encoding="utf-8"?>
<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:columnCount="2"
android:rowCount="2">
<GridLayout
android:id="@+id/aView"
android:layout_columnSpan="1"
android:layout_gravity="fill"
android:layout_rowSpan="2"
android:layout_width="100"
android:layout_height="25"
android:text="1" />
<GridLayout
android:id="@+id/bView"
android:layout_columnSpan="1"
android:layout_gravity="fill"
android:layout_rowSpan="1"
android:layout_height="0dp"
android:layout_width="match_parent"
android:layout_weight="0.5"
android:text="2" />
<GridLayout
android:id="@+id/cView"
android:layout_columnSpan="1"
android:layout_gravity="fill"
android:layout_rowSpan="1"
android:layout_height="0dp"
android:layout_width="match_parent"
android:layout_weight="0.5"
android:text="3" />
</GridLayout>