From following .xml file I set xml to show TabHost but after i run it on emulator it show both both orientation. i want to set it to show only one orientation. How do i do? THanks you.
<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"
android:orientation="vertical">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<FrameLayout android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:layout_above="@android:id/tabs" />
<TabWidget android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" />
</RelativeLayout>
</TabHost>
Set in this
android:screenOrientation="portrait"
in your activity in manifest .add this line in your manifest.xml file.
if you want only landscape orientation then change to
landscape
instead ofportrait
In the AndroidMainfeast.xml file you will see
so Add after .MainActivity
android:configChanges="" help us to prevent onpause() and OnResume() method when we made rotation.