I'm having a hard time to design a GridView
layout with header and footer like this:
What I did is, create a ListView
with just one item which is the GridView
and add the header/footer using addHeaderView()
and addFooterView()
. The problem is that the GridView
doesn't show the whole items. I've disabled the GridView
scrolling using:
gridview.setOnTouchListener(new View.OnTouchListener(){
@Override
public boolean onTouch(View v, MotionEvent event) {
if(event.getAction() == MotionEvent.ACTION_MOVE){
return true;
}
return false;
}
});
Is there a way to show the make the GridView
show all items? I've tried setting the height of the GridView
to wrap_content
but it doesn't work. Here is the layout for the GridView
:
<GridView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/gridview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:numColumns="2"
android:background="@color/main_gray"
android:verticalSpacing="10dp"
android:horizontalSpacing="10dp"
android:stretchMode="columnWidth"
android:gravity="center">
</GridView>
I know it is not right to put gridview inside a listview but the client requested for this kind of layout..