I don't believe the tab host is doing anything special for this, it is just letting the normal focus navigation take place.
On Thu, Mar 5, 2009 at 4:00 PM, ying lcs <[email protected]> wrote: > > Thank you Dianne. > > I have another related question. I appreciate if you can help me with that. > > Let's say the a button in a tab content currently has focus. When I > click the UP button, the tab-widget has the focus. > My question is how can the Tabhost knows that The tab-content reaches > the end of its focusable control and decide to give tab-widget the > focus? > > Thank you. > > On Thu, Mar 5, 2009 at 12:06 PM, Dianne Hackborn <[email protected]> > wrote: > > The comment says is re-directs non-navigation keys to the content. It > isn't > > intercepting the other keys, it is ignoring them (returning false). > > > > On Thu, Mar 5, 2009 at 11:42 AM, ying lcs <[email protected]> wrote: > >> > >> Hi, > >> > >> I am trying to understand TabHost source code. In the setup() , it has: > >> > >> // KeyListener to attach to all tabs. Detects non-navigation keys > >> // and relays them to the tab content. > >> mTabKeyListener = new OnKeyListener() { > >> public boolean onKey(View v, int keyCode, KeyEvent event) { > >> switch (keyCode) { > >> case KeyEvent.KEYCODE_DPAD_CENTER: > >> case KeyEvent.KEYCODE_DPAD_LEFT: > >> case KeyEvent.KEYCODE_DPAD_RIGHT: > >> case KeyEvent.KEYCODE_DPAD_UP: > >> case KeyEvent.KEYCODE_DPAD_DOWN: > >> case KeyEvent.KEYCODE_ENTER: > >> return false; > >> > >> } > >> mTabContent.requestFocus(View.FOCUS_FORWARD); > >> return mTabContent.dispatchKeyEvent(event); > >> } > >> > >> }; > >> > >> My question is why it intersects all LEFT/RIGHT/UP/DOWN key event? If > >> that is the case, can i still use LEFT/RIGHT/UP/DOWN to navigate > >> within the TabContent (let say I have a row of buttons in the > >> TabContent. Can I use LEFT/RIGHT/UP/DOWN to move from 1 button to > >> another in the TabContent)? > >> > >> Thank you. > >> > >> > > > > > > > > -- > > Dianne Hackborn > > Android framework engineer > > [email protected] > > > > Note: please don't send private questions to me, as I don't have time to > > provide private support. All such questions should be posted on public > > forums, where I and others can see and answer them. > > > > > > > > > > > > > -- Dianne Hackborn Android framework engineer [email protected] Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

