tags:

views:

182

answers:

1

Hi,

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,

+1  A: 

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

Reflog