Hello, I manage to find this post right after trying to solve something like this :
http://groups.google.com/group/android-developers/browse_thread/thread/f3fdd1eb17288886/0d28c51a6b9ffdfe?lnk=gst&q=tab+focus#0d28c51a6b9ffdfe Apparently, tabs seems to still the focus of TextView that are not part of them. Any idea of a workaround ? For the moment I just can think of overriding mTabKeyListener, but it's probably private... On Mar 6, 4:45 am, Dianne Hackborn <hack...@android.com> wrote: > 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 <ying...@gmail.com> 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 <hack...@android.com> > > 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 <ying...@gmail.com> 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 > > > hack...@android.com > > > > 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 > hack...@android.com > > 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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---