hi, i didn’t find a way to check when mouse is ove...
# compose
a
hi, i didn’t find a way to check when mouse is over a Box.. i have to show an image when mouse is over an area..
c
if you are talking about #compose-desktop the is a
Modifier.onPointerEvent
Copy code
var hover by remember { mutableStateOf(false) }

Modifier.onPointerEvent(
    PointerEventType.Enter,
    onEvent = {
        hover = true
    },
).onPointerEvent(
    PointerEventType.Exit,
    onEvent = {
        hover = false
    },
)
a
No i am using compose android and there isn’t this action
c
so you are talking about a touch event not a mouse event?
a
i’d like , play video and icon is alpha=0 and when user move mouse near center display icon alpha =1
so i created a box transparent ahd when user move mouse over this box.. app show play icon
c
still not sure about your “mouse”. but have a look at this https://developer.android.com/jetpack/compose/gestures
a
i saw this documentation bur i didn’t find my solution
i’d like to show icon play when user move mouse inside an area
m
@Android75 There is no "mouse" on android. There is generally only touch input. So things like onTouch, onClick, onLongClick, etc....
If you're talking about the emulator itself, shows the mouse pointer only to give you an indication of where your finger would be. It's not actually a mouse in the emulator.
z
There can be a mouse on android, if you plug a mouse into a tablet or are running the app on a Chromebook. But yea the emulator does not forward the host mouse events directly to android unless it’s converting clicks to touches.
218 Views