Android: Perfect solution for ScrollView nested gridview

Source: Internet
Author: User

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:

  1. Public class MyGridView extends GridView {
  2. Public MyGridView (context context, AttributeSet attrs) {
  3. Super (context, attrs);
  4. }
  5. Public MyGridView (context context) {
  6. super (context);
  7. }
  8. Public MyGridView (context context, AttributeSet attrs, int defstyle) {
  9. Super (context, attrs, defstyle);
  10. }
  11. @Override
  12. public void onmeasure (int widthmeasurespec, int heightmeasurespec) {
  13. int expandspec = Measurespec.makemeasurespec (
  14. Integer.max_value >> 2, measurespec.at_most);
  15. super.onmeasure (Widthmeasurespec, expandspec);
  16. }
  17. Turn

Android: Perfect solution for ScrollView nested gridview

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.