문제

In view hierarchy:

  • ViewParent > ScrollView > LinearLayout

When dimensions change, ViewParent.onMeasure calls ScrollView.onMeasure witch calls LinearLayout.onMeasure only if ScrollView.width have changed, what seems normal because LinearLayout is only constrained by his parent width.

How to force LinearLayout.onMeasure, also if ScrollView.width not changed ?

도움이 되었습니까?

해결책

The solution

override ScrollView.onMeasure and add LinearLayout.forceLayout call:

@Override
protected void onMeasure(int wMS, int hMS) {
    if (getChildCount() > 0)
        getChildAt(0).forceLayout();
    super.onMeasure(wMS, hMS);
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top