This article through an example code to solve the development process encountered in the ScrollView nested gridview problem that the GridView will show incomplete solution.
AD: Network + Offline Salon | Mobile app Mode innovation: give you a reason to do the app >>
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 class MyGridView extends GridView {
- Public MyGridView (context context, AttributeSet attrs) {
- Super (context, attrs);
- }
- Public MyGridView (context context) {
- super (context);
- }
- Public MyGridView (context context, AttributeSet attrs, int defstyle) {
- Super (context, attrs, defstyle);
- }
- @Override
- public void onmeasure (int widthmeasurespec, int heightmeasurespec) {
- int expandspec = Measurespec.makemeasurespec (
- Integer.max_value >> 2, measurespec.at_most);
- super.onmeasure (Widthmeasurespec, expandspec);
- }
- Turn http://mobile.51cto.com/aprogram-394381.htm
Android: Perfect solution for ScrollView nested gridview