I am currently trying to implement a FragmentTabHost for my project. I am still new to this snippet, but I found it very good in terms of reusing layouts etc., so I wanted to push it even further. Now I read the tutorials on how to create tabs with snippet, and I came to this guide:
http://maxalley.wordpress.com/2013/05/18/android-creating-a-tab-layout-with-fragmenttabhost-and-fragments/
Now this works fine, except that the tabWidget is on top of my layout, where I wanted it to be at the bottom. I found that I needed to configure tabWidget after all the tabs were initialized, so I tried to add these codes:
mTabWidget = (TabWidget) findViewById(android.R.id.tabs); mTabWidget.setBackgroundColor(Color.WHITE); mTabWidget.setShowDividers(LinearLayout.SHOW_DIVIDER_NONE); mTabWidget.setGravity(Gravity.BOTTOM);
Now this one already removes the separator and changes color, but obviously it wonβt put my widget at the bottom of my layout. Now, how would I do that?
I also tried to edit the Tabhost XML file and just put the TabWidget after FrameLayout, but nothing happens. here xml:
<android.support.v4.app.FragmentTabHost xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/tabhost" android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <FrameLayout android:id="@+id/tabFrameLayout" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" /> <TabWidget android:id="@android:id/tabs" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="0" android:orientation="horizontal" /> </LinearLayout> </android.support.v4.app.FragmentTabHost>
source share