Vertical swipe in Android for horizontal swipe without obstacles

Source: Internet
Author: User

In fact, this is a question of repeated questions. But every time you have to forget the same.

At first I thought it was just a matter of focus, so I spent a lot of time in the layout file of the interview focus, really lack of experience. Originally I was wrong object, for the ListView inside the GridView, in the ListView and GridView outside to write a scrollview on okay, and then the rewrite Onmeasure () method can be

/** * Created by Catherine on 15/7/23. */public class Noscrollgridview extends GridView {public    Noscrollgridview (context context, AttributeSet attrs) {
  super (context, attrs);    }    /**     * Set does not scroll *    /public void onmeasure (int widthmeasurespec, int heightmeasurespec) {        int expandspec = Measurespec.makemeasurespec (Integer.max_value >> 2,                measurespec.at_most);        Super.onmeasure (Widthmeasurespec, Expandspec);}    }

Okay, easy ending!

Remember: Improve code quality.

Vertical swipe in Android for horizontal swipe without obstacles

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: info-contact@alibabacloud.com 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.