在Linearlayout中新增ScrollView支持滚动

Posted lelelong

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在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);
    }

  

以上是关于在Linearlayout中新增ScrollView支持滚动的主要内容,如果未能解决你的问题,请参考以下文章