Question

So I have a Player view with seekbar and play/pause/rewind, etc. buttons, which are ImageButtons that have pressed and normal states, but no selected states.

Given that there are a number of android devices that have a trackball as alternate input (aside from the touchscreen), is there any way for me to prevent the trackball from focusing some of my UI elements? Thing is, i want the trackball to be used solely for the seekbar, but I don't want the user to be able to scroll down/up to focus on the other buttons.

I tried setting focusable=false on the elements i don't want to get focus, but it doesn't work.

Is this even possible?

Was it helpful?

Solution

Tryusing

seekbar.requestFocus();
seekbar.setNextFocusUpId(seekbarid);
seekbar.setNextFocusDownId(seekbarid);
seekbar.setNextFocusLeftId(seekbarid);
seekbar.setNextFocusRightId(seekbarid);

This way the seekbar should always regains the focus even when trackball moves.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top