I want to display 3 GridView
in my Layout
. I don't know how many elements are in each GridView
, so the Layout
should be Scrollable
.
The problem is that the Layout
does not Scroll
, I can't see the third GridView
.
Here is what I have done:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="@dimen/activity_vertical_margin"
android:background="@android:color/holo_blue_light"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:isScrollContainer="true"
android:orientation="vertical">
<TextView
android:id="@+id/textView"
android:text="Category 1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/white"
android:textSize="22sp" />
<GridView
android:id="@+id/gridView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:horizontalSpacing="1sp"
android:numColumns="5"
android:stretchMode="columnWidth"
android:verticalSpacing="1sp"
android:background="@android:color/holo_blue_dark"></GridView>
<TextView
android:id="@+id/textView2"
android:text="Category 2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/white"
android:textSize="22sp" />
<GridView
android:id="@+id/gridView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:horizontalSpacing="1sp"
android:numColumns="5"
android:stretchMode="columnWidth"
android:verticalSpacing="1sp"
android:background="@android:color/holo_blue_dark"></GridView>
<TextView
android:id="@+id/textView3"
android:text="Category 3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/white"
android:textSize="22sp" />
<GridView
android:id="@+id/gridView3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:horizontalSpacing="1sp"
android:numColumns="5"
android:stretchMode="columnWidth"
android:verticalSpacing="1sp"
android:background="@android:color/holo_blue_dark"></GridView>
</LinearLayout>
</ScrollView>
Any Ideas? Thanks