Comments (2)
I handle the problem like this.Maybe help someone,but this not a very good solution.
private int oldScrollY=0;
private int moveStartY=0;
@OverRide
public boolean dispatchTouchEvent(@SuppressWarnings("NullableProblems") MotionEvent event) {
if (mSelfUpdateScroll) {
mIsTouchOngoing = false;
mIsDraggingDraggable = false;
mIsScrolling = false;
mIsFlinging = false;
removeCallbacks(mIdleRunnable);
removeCallbacks(mScrollRunnable);
return super.dispatchTouchEvent(event);
}
final int action = event.getActionMasked();
if (action == MotionEvent.ACTION_DOWN) {
if (getScrollY()>=mMaxScrollY){
oldScrollY=0;
}
moveStartY=0;
mIsTouchOngoing = true;
mScroller.abortAnimation();
if (mDraggableView != null && mDraggableView.getGlobalVisibleRect(mDraggableRect)) {
final int x = (int) (event.getRawX() + .5F);
final int y = (int) (event.getRawY() + .5F);
mIsDraggingDraggable = mDraggableRect.contains(x, y);
} else {
mIsDraggingDraggable = false;
}
} else if (action == MotionEvent.ACTION_UP
|| action == MotionEvent.ACTION_CANCEL) {
moveStartY=0;
mIsTouchOngoing = false;
if (mCloseUpAlgorithm != null) {
removeCallbacks(mIdleRunnable);
postDelayed(mIdleRunnable, mConsiderIdleMillis);
}
}else if(action==MotionEvent.ACTION_MOVE){
if (getScrollY()<mMaxScrollY) {
oldScrollY = getScrollY();
}else if (getScrollY()==mMaxScrollY){
if (moveStartY==0){
moveStartY= (int) event.getRawY();
}else if (moveStartY-event.getRawY()>100){
oldScrollY=0;
}
}
}
final boolean isPrevScrolling = mIsScrolling;
final boolean isPrevFlinging = mIsFlinging;
mIsFlinging = mFlingDetector.onTouchEvent(event);
mIsScrolling = mScrollDetector.onTouchEvent(event);
removeCallbacks(mScrollRunnable);
post(mScrollRunnable);
final boolean isIntercepted = mIsScrolling || mIsFlinging;
final boolean isPrevIntercepted = isPrevScrolling || isPrevFlinging;
final boolean shouldRedirectDownTouch = action == MotionEvent.ACTION_MOVE
&& (!isIntercepted && isPrevIntercepted)
&& getScrollY() == mMaxScrollY;
if (isIntercepted || isPrevIntercepted) {
mMotionEventHook.hook(event, MotionEvent.ACTION_CANCEL);
if (!isPrevIntercepted) {
return true;
}
}
if (shouldRedirectDownTouch) {
mMotionEventHook.hook(event, MotionEvent.ACTION_DOWN);
}
if (action == MotionEvent.ACTION_UP
|| action == MotionEvent.ACTION_CANCEL){
moveStartY=0;
if (getScrollY()==mMaxScrollY&&(mMaxScrollY-oldScrollY<200)){
oldScrollY=0;
return true;
}
}
super.dispatchTouchEvent(event);
return true;
}
from scrollable.
I have fixed it, it's in pull request already: #46
from scrollable.
Related Issues (20)
- View Pager not taking the complete height even on using "match parent" HOT 1
- Not able to get all library views HOT 1
- HeaderView Issue HOT 5
- when Scrolling the page,the headerview can scroll also HOT 1
- What should I do if there are ups and drop refresh ui in viewpager? HOT 1
- dependencies problem HOT 1
- nested two page bug HOT 1
- How to use FragmentStatePager Adapter HOT 1
- ScrollHeader is not smoothly HOT 2
- dude HOT 2
- Change viewpager item size dynamically with listview scroll HOT 5
- Header reappears on top when returning to fragment that has been scrolled down. HOT 8
- Long press slide up RecycleView item before headview scoll up HOT 2
- Scrollable tab scrolls under title bar HOT 1
- add RecyclerView on the head, slide very slowly, there is inertia slow sliding HOT 1
- bottom part of the fragment in the viewpager is clipped or cut of how to fix this HOT 6
- when topView height is changed , tabLayout below will be covered HOT 5
- not use SwipeBackLayoutTouTiao HOT 4
- Cannot collapsed header view programmatically HOT 2
- scrollable scrollview in fragment not scrolled
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scrollable.