关于自定义ViewGroup在ScrollView中无法显示的问题.

你需要在自定义ViewGroup中重写onMeasure方法,用来计算ViewGroup所需要的宽度和高度,然后setMeasuredDimension(width, height);

protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        //省略计算过程
        setMeasuredDimension(720, 2000);
 } 

然后你就惊奇的发现可以了,,,,,我靠!!!!

原文地址:https://www.cnblogs.com/moqi2013/p/3406768.html