I am using a Tab Host in my Android App. I have the Titlebar hidden.
When I leave the App and resume to it, I have some strange behaviour.
If I resume to a tab using a list activity with listView.setAdapter, the title bar is hidden and the space it takes up is consumed by the App. However, if I resume to any tab without the listView.setAdapter, the Titlebar is hidden, but space which was used by it is left behind.
This is pushes my tabs (which are positioned at the bottom of the screen) off the screen. The space is once again consumed by my app if I then change to any other tab.
I have tried to invalidate most of the obvious Views in my App without and success. Below is my tab_activity xml. many thanks
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<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">
<FrameLayout android:id="@android:id/tabcontent"
android:layout_width="fill_parent" android:layout_height="0dip"
android:layout_weight="1" />
<TabWidget android:id="@android:id/tabs"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_weight="0" />
</LinearLayout>
</TabHost>
</LinearLayout>
Here is the Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.tar.projectx" android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<application android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen" android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true">
<activity android:name=".Splash" android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen" android:label="@string/app_name" android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="SearchActivity" android:label="SearchActivity" android:screenOrientation="portrait"></activity>
<activity android:name="SearchListActivity" android:label="SearchListActivity" android:screenOrientation="portrait"></activity>
<activity android:name="ContactActivity" android:label="ContactActivity" android:screenOrientation="portrait"></activity>
</application>
</manifest>
Interestingly, if I use the code below in the onResume method of my mainActivity which holds the tabhost, once the toast disappears, the view is refreshed and the space at the top is taken up by my app again. Obviously, this isn't much of a fix, but may help someone understand what is happening.
@Override
protected void onResume() {
super.onResume();
Toast.makeText(this, "Welcome Back", Toast.LENGTH_LONG).show();
}