Note that there are some explanatory texts on larger screens.

plurals
  1. POTabView mixes content from multiple tabs
    primarykey
    data
    text
    <p>I am using TabView for an activity layout. Unfortunately, the first time that I enter the acticity, TabView displays the content of all tabs at the same time, creating corrupted output.</p> <p>My layout uses an ImageView for the background and adds on top of it the TabHost. The ScrollView is there because the content of some tabs requires scrolling. I do not use separate activities for each tab.</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"&gt; &lt;ImageView android:layout_width="fill_parent" android:layout_height="fill_parent" android:src="@drawable/background_claims" android:scaleType="centerCrop" /&gt; &lt;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"&gt; &lt;LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;TabWidget android:id="@android:id/tabs" android:layout_width="fill_parent" android:layout_height="wrap_content" /&gt; &lt;ScrollView android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;FrameLayout android:id="@android:id/tabcontent" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;LinearLayout android:id="@+id/overview_tab" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content"&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:id="@+id/journey_tab" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:id="@+id/delay_tab" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:id="@+id/personal_tab" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:id="@+id/ticket_tab" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;/LinearLayout&gt; &lt;/FrameLayout&gt; &lt;/ScrollView&gt; &lt;/LinearLayout&gt; &lt;/TabHost&gt; &lt;/FrameLayout&gt; </code></pre> <p>...where I ommit the content of the LinearLayouts for brevity.</p> <p>The LinearLayouts are added as tabs on the Activity's constructor:</p> <pre><code> tabHost = getTabHost(); tabHost.setOnTabChangedListener(this); tabHost.addTab(tabHost.newTabSpec(LIST1_TAB_TAG) .setIndicator(LIST1_TAB_TAG) .setContent(new TabContentFactory() { public View createTabContent(String arg0) { return (LinearLayout) findViewById(R.id.overview_tab); } })); </code></pre> <p>The first tab is supposed to look like this: <img src="https://i.stack.imgur.com/ArhDV.png" alt="Normal First Tabs"></p> <p>However, the first time that I enter the activity it looks like this: <img src="https://i.stack.imgur.com/ijvHT.png" alt="Corrupted tab"></p> <p>The additional content that you see is from other tabs in the same activity. </p> <p>After I click another tab and then go back to the first, the output is fixed (that's how I got the first screenshot). The behaviour is consistent and happens every time I launch the activity. I am using Android 2.3.7 (CM7) on an HD2 if that's relevant.</p> <p>Thanks a lot for any help!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload