开发者

Android: Is it possible to get notified when enter/quit TouchMode?

开发者 https://www.devze.com 2023-03-06 04:12 出处:网络
When system enters into TouchMode, I\'d like to know which widget will lose focus. When system quits TouchMode, I\'d also like to know which widget will get focus. Overriding onFocusChange() didn\'t s

When system enters into TouchMode, I'd like to know which widget will lose focus. When system quits TouchMode, I'd also like to know which widget will get focus. Overriding onFocusChange() didn't satisfy me, since it couldn't tell TouchMode change, since it could happen in every mode, touch, trackball, key navigation, etc.

SDK said only one API View.isInTouchMod开发者_Go百科e() there it is. So, is it possible to detect TouchMode change?


Long shot but you probably need to maintain states manually. So you keep a a flag , lets say isTouchMode which you can set every time any of the widgets are touched and unset when something gets focus.


Use ViewTreeObserver.addOnTouchModeChangeListener(). It will tell you when the mode changes.

http://developer.android.com/reference/android/view/ViewTreeObserver.html

0

精彩评论

暂无评论...
验证码 换一张
取 消