How does one disable/ re-enable touch events in Android? -


quick, simple, question. have view background animating, , during time, want disable user interacting view. view framelayout, , i'm capturing touch events ontouchevent(). solutions i've tried:

1) first setontouchlistener(null), setontouchlistener(this). problem is, view calls ontouchevent(motionevent), , not ontouch(view, motionevent), can't pump through events there.

2) first setenabled(false), setenabled(true). source code says: disabled view clickable still consumes touch events, doesn't respond them. problem is, motionevents still pumped through in ontouchevent().

3) requestdisallowintercepttouchevent(false), (true). handles touch events parent.

the solution have working using boolean variable isanimating, , checking value of in ontouchevent(). i'd rather not this, because looks ugly me , i'd rather use api reinvent wheel, sooo... got ideas? thanks.

try: setfocusable() , setfocusableintouchmode()


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -