SoFunction
Updated on 2025-04-11

Solutions to sliding conflicts of vertical ScrollView on outer layer and horizontal ScrollView on inner layer

Solutions to sliding conflicts of vertical ScrollView on outer layer and horizontal ScrollView on inner layer

Updated: April 15, 2017 10:05:47 Submission: jingxian
Below, the editor will bring you a solution to sliding conflicts of vertical ScrollView on the outer layer and horizontal ScrollView on the inner layer. The editor thinks it is quite good, so I will share it with you now and give you a reference. Let's take a look with the editor

Examples are as follows:

public class CustomScrollView extends ScrollView {

private GestureDetector mGestureDetector;

 mGestureListener;

@SuppressWarnings("deprecation")
public CustomScrollView(Context context,AttributeSet attrs) {

super(context,attrs);

mGestureDetector= new GestureDetector(new YScrollDetector());

setFadingEdgeLength(0);

}
//Judge whether to intercept touch events through gestures.@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
return (ev) && (ev);
}

// Return false if we're scrolling in the x direction

class YScrollDetector extends SimpleOnGestureListener {

@Override
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
if((distanceY) > (distanceX)) {
return true;
}
return false;
}
}
}

The above article on the outer vertical ScrollView and inner horizontal ScrollView sliding conflict is all the content I share with you. I hope you can give you a reference and I hope you support me more.

  • scrollview
  • Horizontal
  • slide

Related Articles

  • Android custom view achieves tag flow effect

    This article mainly introduces the Android custom view to implement tag flow effects. The sample code in the article is very detailed and has certain reference value. Interested friends can refer to it.
    2022-02-02
  • Android Web3j OOM solution detailed explanation

    This article mainly introduces the detailed explanation of Android Web3j OOM solution. The editor thinks it is quite good. I will share it with you now and give you a reference. Let's take a look with the editor
    2018-07-07
  • Detailed explanation of how to loading style when customizing the pull-down refresh of Flutter

    In Flutter, we usually have the RefreshIndicator to set the color and thickness of the drop-down refresh through color or strokeWidth. However, if you want to customize your own widget, the RefreshIndicator does not expose the corresponding attributes, how to modify it? The article introduces it to you very detailed. Friends who need it can refer to it.
    2024-01-01
  • Two ways to change APP icons in Android Studio

    This article mainly introduces two ways to change APP icons in Android Studio. The article introduces the example code in detail, which has a certain reference learning value for everyone's study or work. Friends who need it, please learn with the editor below.
    2020-06-06
  • Flutter Learning of Construction, Layout and Drawing Trilogy

    This article mainly introduces relevant materials on the construction, layout and drawing trilogy of Flutter learning. The example code is introduced in this article in detail, which has certain reference learning value for everyone to learn or use Flutter. Friends who need it, let’s learn together.
    2019-04-04
  • Android imitation Douyu live broadcast barrage effect

    This article mainly introduces the relevant information on the barrage effect of Android imitation Douyu live broadcast. Friends who need it can refer to it.
    2016-10-10
  • Android DownloadManager Manager implements the download function of image

    Android DownloadMananger is similar to a download queue, managing all projects currently downloading or waiting for download. It can maintain HTTP links, and once the download items in the queue fail, it can automatically re-download.
    2023-01-01
  • Basic tutorial on android development—SharedPreferences Reading and Writing

    This article introduces the implementation ideas of SharedPreferences. Interested friends can learn about it.
    2013-01-01
  • Android development gets cropped images from camera or album

    When we need to upload images, we want to crop them to the size we need. Android phones have this function, which is very easy. So how is this function implemented? The following editor will introduce to you Android development to obtain image cropping from cameras or albums. Friends who need it can refer to it.
    2015-10-10
  • Introduction to the technology of developing Android application using PHP

    This article mainly introduces the technology of using PHP to develop Android applications. This article explains how to install PHP for Android, set up PHP for Android development environment, and build Android applications using PHP. Friends who need it can refer to it
    2015-03-03

Latest Comments