0

My Current Layout is

enter image description here

<?xml version="1.0" encoding="utf-8"?>

<ScrollView
    android:id="@+id/scrMain"
    android:layout_width="fill_parent"
    android:layout_height="match_parent"
    android:layout_gravity="top"
    android:fillViewport="true" >


    <RelativeLayout
        android:id="@+id/rl"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >

        <RelativeLayout
            android:id="@+id/llGridToday"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical" android:visibility="gone">

            <FrameLayout
                android:id="@+id/FrameLayout1"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_alignParentTop="true" >

                <ImageView
                    android:id="@+id/imageView2"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:src="@drawable/gridframe" />

                <FrameLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="right"
                    android:layout_marginRight="10dp"
                    android:layout_marginTop="10dp"
                    android:background="@drawable/calender" >

                    <TextView
                        android:id="@+id/txtDateToday"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center"
                        android:gravity="center"
                        android:text="28" />
                </FrameLayout>

                <TextView
                    android:id="@+id/textView1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="10dp"
                    android:layout_marginTop="3dp"
                    android:text="Today"
                    android:textColor="#000" />
            </FrameLayout>

            <GridView
                android:id="@+id/gridToday"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true"
                android:layout_alignParentLeft="true"
                android:layout_below="@+id/FrameLayout1"
                android:layout_weight="1"
                android:numColumns="3" >
            </GridView>
        </RelativeLayout>

        <RelativeLayout
            android:id="@+id/llGridTomorrow"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_below="@id/llGridToday"
            android:orientation="vertical" android:visibility="gone">

            <FrameLayout
                android:id="@+id/FrameLayout1"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_alignParentTop="true" >

                <ImageView
                    android:id="@+id/ImageView01"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:src="@drawable/gridframe" />

                <FrameLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="right"
                    android:layout_marginRight="10dp"
                    android:layout_marginTop="10dp"
                    android:background="@drawable/calender" >

                    <TextView
                        android:id="@+id/txtDateTomorrow"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center"
                        android:gravity="center"
                        android:text="28" />
                </FrameLayout>

                <TextView
                    android:id="@+id/TextView02"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="10dp"
                    android:layout_marginTop="3dp"
                    android:text="Tomorrow"
                    android:textColor="#000" />
            </FrameLayout>

            <GridView
                android:id="@+id/gridTomorrow"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true"
                android:layout_alignParentLeft="true"
                android:layout_below="@+id/FrameLayout1"
                android:layout_weight="1"
                android:numColumns="3" >
            </GridView>
        </RelativeLayout>

        <RelativeLayout
            android:id="@+id/llGridMonth"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/llGridTomorrow"
            android:orientation="vertical" android:visibility="gone">

            <FrameLayout
                android:id="@+id/FrameLayout1"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_alignParentTop="true" >

                <ImageView
                    android:id="@+id/ImageView02"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:src="@drawable/gridframe" />

                <TextView
                    android:id="@+id/TextView03"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="5dp"
                    android:layout_marginTop="2dp"
                    android:text="This Month"
                    android:textColor="#000" />
            </FrameLayout>

            <GridView
                android:id="@+id/gridMonth"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_below="@+id/FrameLayout1"
                android:numColumns="3" android:stretchMode="columnWidth">
            </GridView>
        </RelativeLayout>
    </RelativeLayout>
</ScrollView>

This Layout contains three GridViews. I am making Parent RelativeLayouts of GridViews visible with logic and adding inflated ImageView + TextView to GridView.

Its looking fine. but no scrolling is there.

Lucifer
  • 29,392
  • 25
  • 90
  • 143
Vishal Khakhkhar
  • 2,106
  • 3
  • 29
  • 60
  • Putting scrollable things in scrollable things like this infrequently works. `ScrollView` in particular rarely works out of the box with things that scroll vertically, like `GridView`. – CommonsWare Mar 29 '12 at 21:24
  • gridviews are only scrolable (by default) only when its flowing out of screen....then you may think of using a holder to hold data. – Its not blank Mar 30 '12 at 03:34

2 Answers2

2

yeah what is the point of having three different GridView. Just Create a single GridView as parent and have an separate layout for GridItem so you can style it the way you need to.

UPDATE

isn't something like this will work for you???

one layout with following code

        <GridView 
            android:id="@+id/gridTomorrow" 
            android:layout_width="match_parent" 
            android:layout_height="wrap_content" 
            android:layout_alignParentBottom="true" 
            android:layout_alignParentLeft="true" 
            android:layout_below="@+id/FrameLayout1" 
            android:layout_weight="1" 
            android:numColumns="3" > 
        </GridView>

and another Layout for GridItem

        <FrameLayout   
            android:id="@+id/FrameLayout1"   
            android:layout_width="match_parent"   
            android:layout_height="wrap_content"   
            android:layout_alignParentLeft="true"   
            android:layout_alignParentTop="true" >   

            <ImageView   
                android:id="@+id/ImageView01"   
                android:layout_width="wrap_content"   
                android:layout_height="wrap_content"   
                android:src="@drawable/gridframe" />   

            <FrameLayout   
                android:layout_width="wrap_content"   
                android:layout_height="wrap_content"   
                android:layout_gravity="right"   
                android:layout_marginRight="10dp"   
                android:layout_marginTop="10dp"   
                android:background="@drawable/calender" >   

                <TextView   
                    android:id="@+id/txtDateTomorrow"   
                    android:layout_width="wrap_content"   
                    android:layout_height="wrap_content"   
                    android:layout_gravity="center"   
                    android:gravity="center"   
                    android:text="28" />   
            </FrameLayout>   

            <TextView   
                android:id="@+id/TextView02"   
                android:layout_width="wrap_content"   
                android:layout_height="wrap_content"   
                android:layout_marginLeft="10dp"   
                android:layout_marginTop="3dp"   
                android:text="Tomorrow"   
                android:textColor="#000" />   
        </FrameLayout> 

using an GridAdapter Inflate your GridItems into grid

Mayank
  • 8,777
  • 4
  • 35
  • 60
  • According to the Current Logic.. Both the Above RelativeLayouts containing 2 gridViews are Visibly gone.. but 3 gridviews are must as per functionality as I mentioned below in Macarse's comment's reply – Vishal Khakhkhar Mar 29 '12 at 19:54
  • I am having hard time understanding logic behind the layout @Vishal has posted. Does somebody else make any sense out of it??? – Mayank Mar 29 '12 at 19:56
  • please explain your functionality requiremnts so I can get to understand the logic. Thanks – Mayank Mar 29 '12 at 19:57
0

Not sure why you need three different GridView.

Try making GridView the parent and adding the rest of the View items as GridView's headers.

Macarse
  • 91,829
  • 44
  • 175
  • 230
  • @Macarase.. All the Three Views are for different types of data and Click handling of that data are also different for all the 3 gridview items.. So I thought that is must to have 3 diff. gridviews.. – Vishal Khakhkhar Mar 29 '12 at 19:52
  • @Vishal: Try adding every type in the same `GridView`. – Macarse Mar 29 '12 at 19:57