I'm currently using a GridLayout to get a view that looks something like this:
I'm trying to create this layout by defining the following layout xml:
<android.support.v7.widget.GridLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:columnCount="5"
android:rowCount="2" >
<LinearLayout
android:id="@+id/banner"
android:layout_row="0"
android:layout_columnSpan="5"
android:orientation="horizontal" />
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_row="1"
android:layout_columnSpan="2" />
<RelativeLayout android:id="@+id/previewpane"
android:layout_row="1"
android:layout_column="2"
android:layout_columnSpan="3"/>
</android.support.v7.widget.GridLayout>
While this compiles and runs without crashing, the ViewPager is taking up all the screen space for some reason. Why would this happen (seeing it should only occupy 2 columns out of 5 and only the bottom row) and how can I change this layout to properly display like shown in the illustration?
I didn't manage to get it right using the GridLayout so in the end I decided to just use a RelativeLayout/LinearLayout construction instead. (Using a RelativeLayout as the root view to prevent having to use nested weights)