0

I have Fragment class on which i want to add 3 tabs on the bottom of the screen. Below code is showing tab on upper part of the screen. Please help me find out the solution.

Here is my code:

public class NewVehicleFragment extends Fragment {

private FragmentTabHost tabHost;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    tabHost = new FragmentTabHost(getActivity());
    tabHost.setup(getActivity(), getChildFragmentManager(), R.layout.fragment_new_vehicle);

    Bundle car = new Bundle();
    car.putInt("arg for car", 1);
    tabHost.addTab(tabHost.newTabSpec("Tab1").setIndicator("Car"),
            NewsFragment.class, car);

    Bundle bike = new Bundle();
    bike.putInt("arg for bike", 2);
    tabHost.addTab(tabHost.newTabSpec("Tab2").setIndicator("Bike"),
            NewsFragment.class, bike);

    Bundle cycle = new Bundle();
    cycle.putInt("arg for cycle", 3);
    tabHost.addTab(tabHost.newTabSpec("Tab3").setIndicator("Cycle"),
            NewsFragment.class, cycle);

    return tabHost;
   }
}
Vikash Parajuli
  • 1,361
  • 4
  • 18
  • 45

0 Answers0