I found this solution at http://code.google.com/p/android/issues/detail?id=2516 and it works better than any of the solutions here or on the bug report page, because it addresses the root cause instead of working around it. I'll let the author (g1adrift) explain:
After digging extensively through the Android source, I found the bug:
TabHost registers an OnTouchModeChangeListener in onAttachedToWindow()
that steals focus when leaving touch mode (aka when someone presses a
key) if the current tab content view doesn't have focus. While this
may make sense if the whole layout is tabbed, if there is only a
portion of the layout that has tabs, it causes issues.
This workaround removes that listener, so all artifacts of using it
should go away:
in onCreate(), add:
TabHost mTabHost = (TabHost) findViewById(android.R.id.tabhost);
mTabHost.addOnAttachStateChangeListener(new OnAttachStateChangeListener() {
@Override
public void onViewDetachedFromWindow(View v) {}
@Override
public void onViewAttachedToWindow(View v) {
mTabHost.getViewTreeObserver().removeOnTouchModeChangeListener(mTabHost);
}
});
It supposedly only works for SDK 12+. The author also posted a solution for earlier SDKs. If you need it, click the link above and search for posts by "g1adrift".