i've created ontouchlistener
motion events in activity, , want find happen relative screen.
i can use event.getrawx()
find x co-ordinate, , windowmanager.getdefaultdisplay().getmetrics(new displaymetrics())
or ...getsize(new point())
display dimensions.
the problem i'm having display dimensions consistently reporting width 1080, motionevents receive return numbers greater 1800 getrawx()
.
using deprecated display.getwidth()
returns close, around 1700 - lower what's reported @ right edge of screen.
i assume motion events use different co-ordinate system display metrics - how can convert between two?
cheers
nic
so, have answer. down own stupidity.
what forgot mention viewing screen in landscape mode. using v.getwidth()
, rather display dimension, returns 1920, makes more sense.
so (with hindsight) view width takes account orientation, display width doesn't - i've been reading portrait width (1080) rather landscape width/portrait height (1920).
goodness knows display.getwidth()
returning...
thanks read , thought this, , mihriban reformatting it.
Comments
Post a Comment