0

I have this structure:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ScrollView
        android:id="@+id/scrollViewContainer"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fillViewport="true">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="horizontal">

            <ListView
                android:id="@+id/categories_listView"
                android:layout_width="250dp"
                android:layout_height="match_parent"
                android:background="#FFFFFF"
                android:visibility="gone">

            </ListView>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical">


                <android.support.v4.view.ViewPager
                    android:id="@+id/cataloguesViewPager"
                    android:layout_width="match_parent"
                    android:layout_height="0dp"
                    android:layout_weight="1"/>

                <GridView
                    android:id="@+id/productsGridView"
                    android:layout_width="match_parent"
                    android:layout_height="0dp"
                    android:layout_weight="1"
                    android:drawSelectorOnTop="true"
                    android:gravity="center"
                    android:horizontalSpacing="1dp"
                    android:numColumns="5"
                    android:stretchMode="columnWidth"
                    android:verticalSpacing="1dp">
                </GridView>

            </LinearLayout>

        </LinearLayout>
    </ScrollView>

    <ImageButton
        android:id="@+id/categories_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_margin="5dp"
        android:src="@drawable/categories_button" />

    <ImageButton
        android:id="@+id/send_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_margin="5dp"
        android:src="@drawable/send_button" />

</RelativeLayout>

In my activity, I disable the GridView scroll

productsGridView = (GridView) findViewById(R.id.productsGridView);
productsGridView.setOnTouchListener(new View.OnTouchListener(){
                @Override
                public boolean onTouch(View v, MotionEvent event) {
                    if(event.getAction() == MotionEvent.ACTION_MOVE){
                        return true;
                    }
                    return false;
                }
            });

I want all the views inside the scrollView scrolling, I mean, when I scroll up, all the elements inside the GridView should be shown and the PagerView should be gone.

Any ideas? Thanks!

Ale
  • 2,282
  • 5
  • 38
  • 67

0 Answers0