graphics - Android onTouch called even when touch leaves View -
sanity check needed.
if action_down occurs within view, view's ontouch continues action_move events when point of contact leaves view (!!!).
likewise, if action_down outside view, never receive if touch moves view's area.
this suggests action_down establishes initial association of touch event view, , assocation never changes during life of view no matter touch coordinates may roam. can't imagine why idea, i'm thinking it's option or incomplete initialization or something.
here's ontouch, nothing special except displays coordinates logcat:
public boolean ontouch(view v,motionevent event) { boolean bexitvalue = true; float fx; float fy; int iaction; iaction = event.getactionmasked(); if (motionevent.action_move == iaction) { fx = event.getrawx(); fy = event.getrawy(); log.d("",("x: " + fx + ", y: " + fy)); } else if (motionevent.action_down != iaction) { bexitvalue = false; } return(bexitvalue); } (yes, know more efficient without local floats. i'm using experiment it's byproduct of other tests.)
is intentional behavior? seems odd motionevents reported view isn't user touching. implies code must manually confirm x/y within view's boundaries every time. correct?
thanks!
this how every ui toolkit works, example take win32/linux/whatever, press mouse on scrollbar of web browser, when still pressed move mouse outside scrollbar area, can move mouse outside browser window , yet browser scrolls content move mouse, sounds reasonable?
Comments
Post a Comment