This is a very(!) weird bug, which occurs when one uses D-Pad for
navigation (I used Android Emulator with OS version 2.3.3).
The problem is, when you are in a tabbed activity focused on some
tab's content (press 'down' key if you are focused on a tab), you
press 'up' key, it focuses to an absolutely wrong tab!
This happens though only if in your Android Manifest file you specify
android:minSdkVersion to be more than three.
I think the reason is because of the new focusing algorithm introduced
in newer SDK versions. Please look into this issue. I would appreciate
any collaboration and feedback, especially advice on how to specify
right focusing behavior.
As far as I know this bug does not occur if you
use .setContent(Intent), and not TabFactory (View).
How to reproduce (you can just create new project, paste this
activity, and specify android:minSdkVersion="4" in your manifest
file):
A.java (Activity):
----------------------------------------------------------------------
public class A extends Activity {
private TabHost tabHost;
private TabWidget tabWidget;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
tabHost = (TabHost) findViewById(android.R.id.tabhost);
tabHost.setup();
tabWidget = tabHost.getTabWidget();
final Button a = new Button(this), b = new Button(this), c =
new Button(this);
tabHost.addTab(tabHost.newTabSpec("a").setIndicator("a").setContent(new
TabContentFactory() {
public View createTabContent(String arg0) {
return a;
}
}));
tabHost.addTab(tabHost.newTabSpec("b").setIndicator("b").setContent(new
TabContentFactory() {
public View createTabContent(String arg0) {
return b;
}
}));
tabHost.addTab(tabHost.newTabSpec("c").setIndicator("c").setContent(new
TabContentFactory() {
public View createTabContent(String arg0) {
return c;
}
}));
}
}
----------------------------------------------------------------------
AndroidManifest.xml:
----------------------------------------------------------------------
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.testtabs" android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/
app_name" android:theme="@android:style/Theme.NoTitleBar"
android:debuggable="true">
<activity android:name=".A" android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category
android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="4"/>
</manifest>
----------------------------------------------------------------------
--
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