Gridview show according to actual height within scroll view

android, android-gridview, android-layout, gridview, java

Solution

public class MyGridView extends GridView {

    public MyGridView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public MyGridView(Context context) {
        super(context);
    }

    public MyGridView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

    @Override
    public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2,
                MeasureSpec.AT_MOST);
        super.onMeasure(widthMeasureSpec, expandSpec);
    }
}

Problem

``` <ScrollView android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@+id/titleBarBG" android:layout_alignParentLeft="true" > <RelativeLayout android:id="@+id/scrollContent" android:layout_width="fill_parent" android:layout_height="wrap_content" > <GridView android:id="@+id/issueList" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/archiveTitle" android:layout_marginLeft="5dp" android:layout_marginRight="5dp" android:background="@drawable/customshape" android:numColumns="3" android:overScrollMode="never" android:scrollbars="none" > </GridView> </RelativeLayout> </ScrollView> ``` I would like to create a gridview that act like a table . For example, the size of the grid will increase that will make the gridview taller. Instead of hide the extra content ,I would like the grid view show all content and expand the height when there is additional content How to implement this? thanks

Original source

Related problems