The solution for me gave an id to each type of tab. In the following example, it was necessary to specify an id for each textView (for example, android: id = "@ + id / tab1" ...)
<?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"> <TabWidget android:id="@android:id/tabs" android:layout_width="fill_parent" android:layout_height="wrap_content"> <TextView android:tag="tab1" android:text="@string/tab1" android:layout_width="wrap_content" android:layout_height="fill_parent" android:textSize="12sp" /> <TextView android:tag="tab2" android:text="@string/tab2" android:layout_width="wrap_content" android:layout_height="fill_parent" android:textSize="12sp" /> <TextView android:tag="tab3" android:text="@string/tab3" android:layout_width="wrap_content" android:layout_height="fill_parent" android:textSize="12sp" /> <TextView android:tag="tab4" android:text="@string/tab4" android:layout_width="wrap_content" android:layout_height="fill_parent" android:textSize="12sp" /> <TextView android:tag="tab5" android:text="@string/tab5" android:layout_width="wrap_content" android:layout_height="fill_parent" android:textSize="12sp" /> </TabWidget> <FrameLayout android:id="@android:id/tabcontent" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TextView android:id="@+id/tab1" android:text="Hallo3" android:layout_width="fill_parent" android:layout_height="fill_parent" /> <TextView android:id="@+id/tab2" android:text="Hallo2" android:layout_width="fill_parent" android:layout_height="fill_parent" /> <TextView android:id="@+id/tab3" android:text="Hallo3" android:layout_width="fill_parent" android:layout_height="fill_parent" /> <TextView android:id="@+id/tab4" android:text="Hallo3" android:layout_width="fill_parent" android:layout_height="fill_parent" /> <TextView android:id="@+id/tab5" android:text="Hallo3" android:layout_width="fill_parent" android:layout_height="fill_parent" /> </FrameLayout> </LinearLayout> </TabHost>
Misha source share