1

I am trying to display multiple GridView in a LinearLayout and ScrollView but if the content of the first scroll view is more then the first GridView fills the screen and the scroll is not working. here is my current layout

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/FrameLayout1"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <ScrollView
        android:id="@+id/scrollview"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical" >

            <TextView
                android:id="@+id/owngroup_tv"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/own_groups"
                android:textAppearance="?android:attr/textAppearanceLarge" />

            <GridView
                android:id="@+id/GridView1"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" >
            </GridView>

            <TextView
                android:id="@+id/ingroup_tv"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/in_groups"
                android:textAppearance="?android:attr/textAppearanceLarge" />

            <GridView
                android:id="@+id/inGroups"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" >
            </GridView>
        </LinearLayout>
    </ScrollView>

</FrameLayout>
dharanbro
  • 1,327
  • 4
  • 17
  • 40

2 Answers2

0

Change android:layout_width="match_parent" of the GridView and test a value. Smae action with the LinearLayout.

Example : android:layout_width="400dp"

BSK-Team
  • 1,750
  • 1
  • 19
  • 37
0
parentScrollView.setOnTouchListener(new View.OnTouchListener() {

public boolean onTouch(View v, MotionEvent event)
{
    findViewById(R.id.childScrollView).getParent().requestDisallowInterceptTouchEvent(false);
return false;
}
});
childScrollView.setOnTouchListener(new View.OnTouchListener() {

public boolean onTouch(View v, MotionEvent event)
{

// Disallow the touch request for parent scroll on touch of
// child view
v.getParent().requestDisallowInterceptTouchEvent(true);
return false;
}
});`

here chield scroll view can be replace with your gridview

Android
  • 8,995
  • 9
  • 67
  • 108