Wednesday, July 13, 2011

[android-developers] TabActivity & ViewFlipper - Orientation change

Hello all!

I'm developing an app on 2.2 in which I have 6 tabs. I have one
activity for each tab. My first Tab has a SafeViewFlipper which works
fine. However, I'm facing two problems.

1. The contents of the first tab are visible in all other tabs. Any
ideas why?

2. When I rotate the device(Galaxy Tab) or emulator from portrait to
landscape mode, the contents of all tabs disappear. To change the
layout for different orientations, I created layout-land and layout-
portrait folders but this does not fix the problem. Any suggestions
would be highly appreciated.

More information:

I have an xml file for each tab which I have included in the main.xml
file using <include>

This is my main.xml file:

<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@android:id/tabhost">
<LinearLayout android:layout_width="fill_parent"
android:id="@+id/linear_layout" android:layout_height="fill_parent"
android:padding="5dp">
<TabWidget android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"></TabWidget>
<FrameLayout android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<include android:id="@+id/include0" layout="@layout/tab1"
android:layout_height="wrap_content"
android:layout_width="wrap_content"></include>
<include android:id="@+id/include1" layout="@layout/tab2"
android:layout_height="wrap_content"
android:layout_width="wrap_content"></include>
<!-- More includes -->
</FrameLayout>
</LinearLayout>
</TabHost>

Thanks in advance,
Y

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment