In the development of the need to ScrollView nested gridview case, because the two controls have their own scroll bar, when they encounter together, there will be a problem, that is, the GridView will display incomplete.
Workaround, customize a GridView control
Public classMyGridViewextendsGridView { PublicMyGridView (Context context, AttributeSet attrs) {Super(context, attrs); } PublicMyGridView (Context context) {Super(context); } PublicMyGridView (context context, AttributeSet attrs,intDefstyle) { Super(context, attrs, Defstyle); } @Override Public voidOnmeasure (intWidthmeasurespec,intHeightmeasurespec) { intExpandspec =Measurespec.makemeasurespec (Integer.max_value>> 2, Measurespec.at_most); Super. Onmeasure (Widthmeasurespec, Expandspec); } }
We're not going to have this situation if we use MyGridView.
Android ScrollView and GridView mixed use