A brief discussion on the conflict resolution method between Viewpager and carousel diagram
Examples are as follows:
//Solve the sliding conflict between ViewPager and carousel map@Override public boolean dispatchTouchEvent(MotionEvent ev) { switch (()) { case MotionEvent.ACTION_DOWN: // Make the parent control of the current viewpager not intercept the touch event getParent().requestDisallowInterceptTouchEvent(true); downX = (int) (); downY = (int) (); break; case MotionEvent.ACTION_MOVE: int moveX = (int) (); int moveY = (int) (); if ((moveX - downX) >= (moveY - downY)) { // Sliding carousel getParent().requestDisallowInterceptTouchEvent(true); } else { // Refresh listview getParent().requestDisallowInterceptTouchEvent(false); } break; } return (ev); }
The above article briefly discusses the conflict resolution between Viewpager and carousel pictures. This is all the content I share with you. I hope you can give you a reference and I hope you can support me more.
Related Articles
Detailed explanation of the process of implementing background timing tasks on Android WorkManager
WorkManager is a powerful component of Android Jetpack, used to handle background time-consuming tasks. The background tasks can be one-time or repetitive. The article introduces the sample code in detail and has a certain reference learning value for everyone's learning or work. If you need them, please learn with the editor below.2023-01-01Tutorial on building a Flutter environment under Android Studio
This article mainly introduces the graphic tutorial for building a Flutter environment under Android Studio in detail, which has certain reference value. Interested friends can refer to it.2019-07-07Methods for passing parameters and result return when Fragment jumps (recommended)
Today I will summarize the method of parameter transmission and result return between Fragments. It is very good and has reference value. If you need it, please refer to it.2017-01-01Android instance code to implement custom circular progress bar
The progress bar is used in Android. This article introduces the Android custom circular progress bar implementation code. Friends who need it can refer to it.2016-11-11Android uses AudioRecord to implement the instance code of pause recording function
This article mainly introduces the example code of Android using AudioRecord to implement pause recording function, which has certain reference value. If you are interested, you can learn about it.2017-06-06Android custom popup window usage tips
This article mainly introduces the skills of using Android custom popup window PopupWindow. The sample code in the article is introduced in detail and has certain reference value. Interested friends can refer to it.2016-11-11Android custom dialog implementation code
This article mainly introduces the relevant information about the implementation code of Android custom dialog. Friends who need it can refer to it2017-03-03Android realizes the combination of layout animation and shared animation
Today I bring you interactive animations that can enhance the user experience. They are very simple to use and the experience effect is very good. Only layout animations and shared animations are used. The article is introduced in very detailed through code examples. Interested students can try it yourself.2023-09-09ViewPager in Android gets the currently displayed Fragment
This article mainly introduces two methods for ViewPager to obtain the currently displayed Fragment in Android. One is to use the getSupportFragmentManager().findFragmentByTag() method, and the other is to rewrite the adapter's setPrimaryItem() method. Friends in need can refer to it. Let's take a look together.2017-01-01Introduction to Android WebView Pre-rendering
This article mainly introduces the introduction of Android WebView pre-rendering. The article focuses on the theme and has certain reference value. Friends who need it can refer to it.2022-09-09