I have a TabActivity containing a series of four tabs and a listview.
Each of the tabs reference the same listview.
When the activity is initially displayed, the listview is not displayed.
However, clicking on another tab will display it correctly and clicking 
back on the first tab will also display it correctly.
The content of the listview is changed depending on the selected tab.

Here is my XML layout :
<?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="match_parent"
    android:layout_height="match_parent" >
    
    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical" >
        
        <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" >

            <ListView
                android:id="@+id/listPoisFound"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" >
            </ListView>
            
        </FrameLayout>
    </LinearLayout>

</TabHost>

The tabs are initialised like this :
        TabHost tabhost = null;
        TabHost.TabSpec spec = null;
        // get the tabhost
        tabhost = getTabHost();
        
        // create the individual tabs
        spec = tabhost.newTabSpec("first");
        spec.setIndicator("First");
        spec.setContent(R.id.list);
        tabhost.addTab(spec);
        
        spec = tabhost.newTabSpec("second");
        spec.setIndicator("Second");
        spec.setContent(R.id.list);
        tabhost.addTab(spec);
        
        spec = tabhost.newTabSpec("third");
        spec.setIndicator("Third");
        spec.setContent(R.id.list);
        tabhost.addTab(spec);
        
        spec = tabhost.newTabSpec("fourth");
        spec.setIndicator("Fourth");
        spec.setContent(R.id.list);
        tabhost.addTab(spec);
        
        tabhost.setCurrentTab(0);
        
        tabhost.setOnTabChangedListener(this);

Has anyone come across this problem ?
What is the solution ?

-- 
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

Reply via email to