java - Android: getX getY initial delay -
this question has answer here:
- android action_move threshold 2 answers
when reading getx()
, gety()
values series of ontouch
events, find action_move
events return action_down
coordinates until distance threshold these coordinates has been passed. onwards correct coordinates returned.
steps reproduce:
- create new application project default activity
add following method default activity:
@override public boolean ontouchevent(motionevent event) { log.i("getxydelay", "(x,y)=("+event.getx() + "," + event.gety() + ")"); return super.ontouchevent(event); }
run on device , watch logcat touch , drag
you should see that, on every touch , drag, getx()
/gety()
results start changing after finger has moved half centermeter or so, , on accurate.
i can see how lot of circumstances helpful, causes issues in application i'm writing, so:
- is initial lag over-ridable? or can bypassed?
- is device specific?
ideally i'd turn off single opengl surface view.
note:
- it doesn't happen when use samsung note spen.
- the same happens
getrawx()/getrawy()
. - this doesn't happen on emulator presumably coming hardware touch drivers.
update: i'm assuming caused hardware drivers or similar level, , such beyond application's control. i've attempted post android developer group, after several weeks seems moderators still sitting on post.
the difference between getx()
, getrawx()
is,
getrawx()
, getrawy()
guaranteed return absolute coordinates, relative device screen.
while getx()
, gety()
, should return coordinates, relative view, dispatched them.
also, problem facing, because of following reason
layout of contents of window happens after elements constructed , added parent views. has way, because until know components view contains, , contain, , on, there's no sensible way can lay out.
so getting delay.
Comments
Post a Comment