在Linearlayout中新增ScrollView支持滚动

https://blog.csdn.net/wenzhi20102321/article/details/53491176

1、一般只需要在布局中加个ScrollView即可

2、如果布局中包含listView或者gridView的话,需要重写listView或者gridView中的onMeasure方法

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

  

猜你喜欢

转载自www.cnblogs.com/longjunhao/p/8995207.html