AndroidTagGroup
AndroidTagGroup copied to clipboard
Scrolling Tag Touch Issue
If a tag is clicked, while within a scroll view, and then that scroll view is scrolled, it will remain highlighted.
For example: if I am scrolling, and then I scroll by touching a tag and flicking upwards or downwards, then the tag will remain highlighted afterI have removed my finger.
Same Issue I also getting.
I find same issue
now I write TagView onTouchEvent
like this:
@Override
public boolean onTouchEvent(MotionEvent event) {
if (mState == STATE_INPUT) {
// The INPUT tag doesn't change background color on the touch event.
return super.onTouchEvent(event);
}
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN: {
getDrawingRect(mOutRect);
isPressed = true;
invalidatePaint();
- invalidate();
break;
}
case MotionEvent.ACTION_MOVE: {
if (!mOutRect.contains((int) event.getX(), (int) event.getY())) {
isPressed = false;
invalidatePaint();
- invalidate();
}
break;
}
case MotionEvent.ACTION_UP: {
isPressed = false;
invalidatePaint();
- invalidate();
+ postInvalidate();
break;
}
}
I have solved this issue.
just add:
case MotionEvent.ACTION_CANCEL: { // same as MotionEvent.ACTION_UP }
The reason is: When TagGroup within ScrollView, the TagView's MotionEvent.ACTION_MOVE and MotionEvent.ACTION_UP will be interrupted, then it's MotionEvent.ACTION_CANCEL will be Called, so we just need copy the code of MotionEvent.ACTION_UP to MotionEvent.ACTION_CANCEL.
This has solved my problem, hope worked for you too.