Here's a bizarre behavior that I'm getting with Android tabs. Or maybe the emulator is to blame! Below you have the XML for the layout.
The layouts designed separately for each tab are res/layout/tab1.xml and res/layout/tab2.xml ... and everything seems to be working fine except that when it's drawing it overlaps the tabs some how. If I select TAB1 everything looks normal, but if I select TAB2 it just draws over the tab1 layout. If I go back to tab1 then again everything looks normal.
So why does it draw over the layout from tab1 instead of starting from a black/blank screen? Isn't the TabWidget supposed to handle these situations and call a clear() method or something, before drawing the layout and contents of tab 2?
I'm emulating a machine that has Android 2.2 (API level 8).
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout android:orientation="vertical"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:padding="5dp">
<TabWidget android:id="@android:id/tabs"
android:layout_width="fill_parent" android:layout_height="wrap_content" />
<FrameLayout android:id="@android:id/tabcontent"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:padding="5dp">
<include layout="@layout/tab1" />
<include layout="@layout/tab2" />
</FrameLayout>
</LinearLayout>
</TabHost>
EDIT: Upon request I'll add the tab2 layout which is basically a blank screen!
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
</LinearLayout>
So any ideas why if I switch to tab2... it just draws (adds the Strings) over tab1's controls (buttons, etc.) and doesn't start from a blank/black screen?