I have a fragment with a textView
giving instructions, and below a gridView
. I wanted for the textView
to scroll upwards with the gridView
. In other words: for textView
to disappear off screen when gridView
is scrolling.
My idea of how to accomplish this is to give the gridView
a fixed height that would make the entire layout scrollable - including the textView
. However, up until I cannot achieve this. Is there a way to do this?
Layout no scroll:
When scrolled:
Any help/advice would be appreciated.
My layout XML:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/LightGrey"
android:gravity="center_horizontal|center_vertical"
android:orientation="vertical" >
<TextView
android:id="@+id/chooseLine"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="18dp"
android:text="@string/chooseLine"
android:textAppearance="?android:attr/textAppearanceLarge" />
<GridView
android:id="@+id/gridLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:columnWidth="130dp"
android:fitsSystemWindows="false"
android:gravity="center"
android:horizontalSpacing="5dp"
android:numColumns="auto_fit"
android:paddingTop="0dp"
android:stretchMode="columnWidth"
android:verticalSpacing="25dp" />
</LinearLayout>