I am trying to create tabs within a fragment. I have a fragment named "Food_layout.xml"
here is the xml file.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent">
<TextView
android:text="Food Layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="149dp"
android:layout_marginStart="149dp"
android:layout_marginTop="199dp"
android:id="@+id/textView3" />
</RelativeLayout>
Here is the java class for the fragment
package com.example.crims.plfitness;
import android.app.Fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
public class FoodFragment extends Fragment{
View myView;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
myView = inflater.inflate(R.layout.food_layout, container, false);
return myView;
}
}
I tried adding a TabHost but when I run the program it was not displayed. I was told I need to use a child fragment manager. I looked into it but I really did not find anything on how to implement it. I am new to android development.