I finally found a good way to do this. The Android documentation states that when you need to process modifications (orientation, keyboard ...) without re-creating a new action, you must do this by overriding the onConfigurationChanged method of the Activity class. You must indicate the changes that you make sense in the manifest file of your activity.
You can find more information about this here .
In my case, the Activity manifest looks like this:
<activity android:name=".MyActivity" android:configChanges="orientation"></activity>
And inside my MyActivity activity, I added the following method:
@Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); int visibility = View.VISIBLE; if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) { visibility = View.GONE; } getTabHost().getTabWidget().setVisibility(visibility); }
with the following location of my activity:
<?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="fill_parent" android:layout_height="fill_parent"> <LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <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" /> </LinearLayout> </TabHost>
Thus, when I hide / show the tabWidget panel, the VideoView (which is added to the contents of the TabHost changes in size, and when in the landscape, I have a full-screen movie view.
I hope this helps some of you.
Bertrand
source share