我在自定义gridview类中膨胀标题,当滚动gridview时,标题在android中重叠

时间:2014-09-20 06:17:03

标签: android gridview scroll overlapping

这是我的代码。 我也创建了一个标题,它正在膨胀为gridview的标题。     

           <tv.saamnang.view.GridView
               android:id="@+id/gridViewProducts"
               android:layout_width="match_parent"
               android:layout_height="match_parent"
               android:background="@color/grey_light"
               android:horizontalSpacing="10dip"
               android:listSelector="@null"
               android:numColumns="2"
               android:paddingBottom="10dip"
               android:paddingLeft="10dip"
               android:paddingRight="10dip"
               android:scrollbars="none"
               android:verticalSpacing="10dip" />
       </RelativeLayout>

请帮帮我。 谢谢 亲切的问候 Aditya Tenguria

enter image description here

1 个答案:

答案 0 :(得分:0)

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

            <RelativeLayout
                android:id="@+id/header"
                android:layout_width="match_parent"
                android:layout_height="50dp"
                android:layout_alignParentTop="true" >

                /* ANYTHING YOU WANT IN YOUR HEADER */

            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/gridview"
                android:layout_width="match_parent"
                android:layout_height="fill_parent"
                android:layout_below="@+id/header"
                android:layout_above="@+id/footer" >

                /* GRIDVIEW HERE */

            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/footer"
                android:layout_width="match_parent"
                android:layout_height="50dp"
                android:layout_alignParentBottom="true" >

                /* ANYTHING YOU WANT IN YOUR FOOTER */

            </RelativeLayout>

        </RelativeLayout>