'OnHoverListener is not working on an android emulator?
I'm trying to add mouse/touchpad support to my app and that includes hover support. As per the android guidelines, which say:
Developers can make their app layouts feel polished and easier to use by handling hover events. This is especially true for custom views. The two most common examples of this are:
- Indicating to users if an element has interactive behavior, such as being clickable or editable, by changing the mouse pointer icon.
- Adding visual feedback to items in a large list or grid when the pointer is hovering over them
yourView.setOnHoverListener { view, _ ->
addVisualHighlighting(true)
view.pointerIcon =
PointerIcon.getSystemIcon(view.context,
PointerIcon.TYPE_HAND)
false // listener did not consume the event.
}
This is not working e.g. the pointer icon is not changing and a debug/print line is NOT being called, at least not on an emulator. I am unable to test on a real device so could this be a limitation of the android emulator or am I wrongly implementing this listener? Would it run correctly on the Windows 11 subsystem for android?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
