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;
   }
}
Viks
  • 1,510
  • 4
  • 22
  • 50
  • 2
    Take a look at this SO question: http://stackoverflow.com/questions/2395661/android-tabs-at-the-bottom – Andre Perkins Jun 30 '14 at 16:42
  • yes i watch ... please read carefully my question im implementing on **Fragment** – Viks Jun 30 '14 at 17:00
  • Take a look at https://github.com/astuetz/PagerSlidingTabStrip , it is an widget that can be added to your layout at your will, no matter top or bottom of the screen. – Xiao Liang Jun 30 '14 at 17:18
  • @Lzzy Leung thanks for the suggestion i'll implement it, but for now i need help on this situation. – Viks Jun 30 '14 at 17:27

0 Answers0