在HorizontalScrollView中如果要嵌套CustomView,要在CustomView的onMeasure方法设置CustomView的宽高,不然CustomView不能显示出来。
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int width = MeasureSpec.getSize(widthMeasureSpec);
int height = MeasureSpec.getSize(heightMeasureSpec);
setMeasuredDimension(width, height);
}