2

I have a View Group and it has 2 focusable Views as its children. I would like know how I can customize how focus is being passed between these 2 Views. In other words, when I press the Down Key or the Up Key in the emulator, i want to control which of these children has focus.

I read the JavaDoc of ViewGroup, I see these 2 methods.

public View focusSearch (View focused, int direction)
public boolean requestFocus (int direction, Rect previouslyFocusedRect)

But I am confused which of these method I should over-ride to achieve what I want.

Thank you for any advice.

Regards,

Carl Manaster
  • 39,912
  • 17
  • 102
  • 155
n179911
  • 19,547
  • 46
  • 120
  • 162
  • Have you managed it somehow? se I have a similar issue: http://stackoverflow.com/questions/29538526/custom-viewgroup-focus-handling – traninho Apr 09 '15 at 12:55

1 Answers1

1

you can also try using android:nextFocusDown attribute, like in focus_3.xml example from the ApiDemos.

Lucifer
  • 29,392
  • 25
  • 90
  • 143
reflog
  • 7,587
  • 1
  • 42
  • 47