I am learning Android development and I am trying to make a tab interface inside a fragment, with the tabs in the bottom. I have seen many web pages (like this one) about how to configure the tabs to be in the bottom using a RelativeLayout
but I can't get things right in the screen.
The tab's FrameLayout
is taking all the space for the tab interface, and the tabs can't be seen:
The code I am using is:
<android.support.v13.app.FragmentTabHost
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@android:id/tabhost"
android:layout_marginRight="5dp"
android:layout_alignTop="@+id/ibRight"
android:layout_alignBottom="@+id/ibRight"
android:layout_toLeftOf="@+id/ibRight"
android:layout_alignLeft="@+id/ibTop">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TabWidget
android:id="@android:id/tabs"
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</RelativeLayout>
</android.support.v13.app.FragmentTabHost>
Just as a quick test, I adjusted the FrameLayout
width and height to be fixed (500dp and 200dp), and that's what I got:
So this way I can see that all things are there, but I can't get it to be shown right, without playing with fixed width and height numbers. AND the fact that Android Studio has a bug which causes a null reference for rendering for FragmentTabLayout make things even harder to play with, since I can't test option in real time.
I appreciate if anyone can help me with this, since I new to Android, I am not quite sure how to get this done.