解决ListView里面嵌套GridView * GridView显示不全

public class MyGridView extends GridView{
    public MyGridView(Context context) {
        super(context);
    }

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

    public MyGridView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }
    //改变测量模式

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        //需要改变的只是高度的测量模式
        int heightMes = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST);
        super.onMeasure(widthMeasureSpec, heightMes);
    }
}

猜你喜欢

转载自blog.csdn.net/user_app/article/details/80385769