I'm currently coding an application that uses a lot of Fragments accessible using a Navigation Drawer. So far so good, but I also want to have a TabHost with 2 Tabs inside one of the Fragments. How do I best implement it? This is a code snippet:
public class SectionFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
int position = getArguments().getInt("position");
if (position == 0) {
rootView = inflater.inflate(R.layout.startmenu_layout, container,
false); // die rootView zum Weiterarbeiten holen
} else if (position == 1) {
rootView = inflater.inflate(R.layout.startmenu_layout, container,
false);
and so on...
How do I proceed best? Thanks in advance,
forumfresser
here is a code i use for my TabHost i know how you feel cause it's really hard to find a working tutorial and a working example out there...
anyway
and here is the xml code I use
make sure you change the background of the TabWidget according to your res
you can put the xml code wherever you want in your layout file, a RelativeLayout or a LinearLayout... and you can change the type of the data shown in the tabs... Hope I could help :)