我有Fragment
课程,我想在屏幕的底部上添加3个标签。下面的代码显示在屏幕上方的选项卡。请帮我找出解决方案。
这是我的代码:
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;
}
}