This is my 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:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<FrameLayout
android:id="@+id/realtabcontent"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
/>
</LinearLayout>
And this is the hosting Fragment .
public class TabPractice extends Fragment{
private FragmentTabHost mTabHost;
//Mandatory Constructor
public TabPractice() {
}
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.tabs_practice,container, false);
mTabHost = (FragmentTabHost)rootView.findViewById(android.R.id.tabhost);
mTabHost.setup(getActivity(), getChildFragmentManager(), R.id.realtabcontent);
mTabHost.addTab(mTabHost.newTabSpec("Practice All").setIndicator("Practice All"),
WelcomeScreen.class, null);
mTabHost.addTab(mTabHost.newTabSpec("Practive Fav").setIndicator("Practive Fav"),
FavoriteList.class, null);
return rootView;
}
}
This is how my Tab Looks , I am getting no idea how to style those Tabs. In most examples that explain styling , there is a TabWidget in XML , which when I try to add in my layout it doesnt work .
1) Can some one help me understand how hosting a FragmenttabHost in Fragment (mycode- from some tutorial) is different from having it in a FragmentActivity ??
2) How can I style the tab in my code ??
Thanks.