Comments (7)
I can confirm this bug
from devsmartlib-android.
Replacing dispatchTouchEvent with @OverRide
public boolean onTouchEvent(MotionEvent event) {
boolean handled = mGesture.onTouchEvent(event);
return handled;
}
and
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
switch( ev.getActionMasked() ){
case MotionEvent.ACTION_DOWN:
mInitialX = ev.getX();
mInitialY = ev.getY();
return false;
case MotionEvent.ACTION_MOVE:
float deltaX = Math.abs(ev.getX() - mInitialX);
float deltaY = Math.abs(ev.getY() - mInitialY);
return ( deltaX > 5 || deltaY > 5 );
default:
return super.onInterceptTouchEvent(ev);
}
}
??
from devsmartlib-android.
I can confirm that the previous solution corrects the bug, thanks for that.
from devsmartlib-android.
@vrash your fix doesn't work properly. It causes big view jumps
from devsmartlib-android.
@httpdispatch well, @vrash fix is almost correct. It's working very good for me after I changed return false; to return true; in case ACTION_DOWN - so:
@Override
public boolean dispatchTouchEvent(final MotionEvent ev) {
boolean handled = super.dispatchTouchEvent(ev);
handled |= mGesture.onTouchEvent(ev);
return handled;
}
@Override
public boolean onInterceptTouchEvent(final MotionEvent ev) {
switch (ev.getAction() & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_DOWN:
mInitialX = ev.getX();
mInitialY = ev.getY();
//HERE RETURN TRUE INSTEAD OF FALSE
return true;
case MotionEvent.ACTION_MOVE:
final float deltaX = Math.abs(ev.getX() - mInitialX);
final float deltaY = Math.abs(ev.getY() - mInitialY);
return deltaX > 5 || deltaY > 5;
default:
return super.onInterceptTouchEvent(ev);
}
}
from devsmartlib-android.
Thanks @vrash, its solved my problem :)
from devsmartlib-android.
@kamilzych your approach also has issue. I am testing new one
float mInitialX;
float mInitialY;
boolean mIsMoving;
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
// experimental update to avoid view flickers and onclick events fired
// after move
boolean handled = mGesture.onTouchEvent(ev);
switch (ev.getAction() & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_DOWN:
mInitialX = ev.getX();
mInitialY = ev.getY();
mIsMoving = false;
break;
case MotionEvent.ACTION_MOVE: {
final float deltaX = Math.abs(ev.getX() - mInitialX);
final float deltaY = Math.abs(ev.getY() - mInitialY);
mIsMoving = deltaX > 5 || deltaY > 5;
}
break;
}
if (!mIsMoving) {
handled |= super.dispatchTouchEvent(ev);
}
return handled;
}
It also has an issue that child component may not receive ACTION_UP event, but at least view should not flicker and on click works as expected
from devsmartlib-android.
Related Issues (20)
- HorizontalListView: scrollTo last items HOT 13
- can you add the ability to be notified when the list reaches the beginning or end? HOT 2
- Optional center-lock feature HOT 1
- getFirstVisiblePosition returns 0 HOT 1
- Please implement smoothScrollToPosition(int position)
- HorizontalListView item width incurrent when scroll again and again. and solution.
- Horizontal ListView alternative
- Unable to find class error
- How to let horizontal listview could be use “setSelection” (I want the listview comes out in the middle position) HOT 9
- Listview flickers when list view item has clickable item and has click listner??
- Cannot build library in eclipse HOT 2
- No default press and click effect
- How to center the child if there is only one child in horizontalListview. HOT 2
- Should add support for Gradle and Maven.
- Importing library to Android Studio HOT 1
- How I can make default scroll to the last item in the ListView? HOT 2
- Link for new repo not working
- 左右多滑动几次,item排列就乱了
- Scroll to last position
- Fast Scroll Problem in HorizontalListView
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 devsmartlib-android.