As you can see the fragment content "New Text" begins at the same line as the tab widget. The tab content is simply:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:layout_gravity="center_horizontal" />
</LinearLayout>
and tha tab layout:
<android.support.v4.app.FragmentTabHost
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@android:id/tabhost">
<RelativeLayout
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"
android:background="@color/white"/>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:id="@+id/tab1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"/>
<LinearLayout
android:id="@+id/tab2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"/>
</FrameLayout>
</RelativeLayout>
</android.support.v4.app.FragmentTabHost >
I tried with padding but padding is not very secure because the tab widget height changes on orientation change. I also tried
android:layout_alignParentBottom="@android:id/tabs"
on the frame layout, however this has no effect.
How can I position the tab content correctly under the tab widget/navigation?
EDIT fragment setup:
mTabHost = (FragmentTabHost)rootView.findViewById(android.R.id.tabhost);
mTabHost.setup(getActivity(), getChildFragmentManager(), android.R.id.tabhost);
mTabHost.addTab(mTabHost.newTabSpec("tab1").setIndicator("Tab 1"),
SomeFragment.class, null);
mTabHost.addTab(mTabHost.newTabSpec("tab2").setIndicator("Tab 2"),
SomeFragment.class, null);