使用FragmentTabHost的时候需要设定标签
在标签中设置相关的图片和文字
fthTabHost.setup(this,getSupportFragmentManager(),R.id.fl_content);
TabHost.TabSpec tabSpec = fthTabHost.newTabSpec("readData");
View indicatorView = View.inflate(this, R.layout.tabhost_indicator, null);
ImageView indicatorIcon = (ImageView) indicatorView.findViewById(R.id.indicator_icon);
TextView indicatorText = (TextView) indicatorView.findViewById(R.id.indicator_text);
indicatorIcon.setBackgroundResource(R.mipmap.ic_launcher);
indicatorText.setText("读取表数据");
tabSpec.setIndicator(indicatorView);
fthTabHost.addTab(tabSpec,ReadDataFragment.class,null);
并且在使用设置标签之前需要先为FragmentTabHost设置一个Manager后设置的话会出现空指针的异常.