tags:

views:

488

answers:

2

I have an Activity which has a Scrollview as the top level element. Inside there are some other Views and at some point there is a TabHost. You might get a better impression by looking at the screenshot. The TabHost has three tabs, each with another Activity that are launched by an Intent.

Everything is working fine except one thing. Whenever I click on a Tab, the Scrollview automatically scrolls down as you can see over here. The TabHost is out of the screen afterwards. I simply don't want it to scroll down, but can't see what the problem is. I tested on a 1.5 and 1.6 device and a 2.0 Emulator with the same results.

The xml of my TabHost looks like this:

    <TabHost
        android:id="@+id/tabhost"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content">
        <LinearLayout
            android:orientation="vertical"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content">
            <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="wrap_content">
            </FrameLayout>
        </LinearLayout>
    </TabHost>

And this is the code for adding a Tab:

private void addTab(int descriptionRes, Class<?> destination, int flags) {
    String description = getString(descriptionRes);
    TabSpec spec = mTabHost.newTabSpec(description);
    spec.setIndicator(description);
    Intent i = new Intent(this, destination);
    i.setData(Uri.parse(member.getId())).setFlags(flags);
    spec.setContent(i);
    mTabHost.addTab(spec);
}

Any suggestions?

A: 

You could try setting the Activity inside the TabHost as scrollable, rather than the top-level Activity itself.

Christopher
A: 

Hi, Ulrich Scheller. I am having same problem did you find the solution.

androidProgrammer
Unfortunately I could not find a real solution so far. I created a hack, that scrolls the view up again. Maybe the problem is fixed in a current SDK. It was quite some time ago when I worked on it last time.
Ulrich Scheller
Could you share hack you created with me.
androidProgrammer