我想在我的标签上增加使用默认Android轻扫标签
的文字大小这里是我用来设置标签
的代码 public class MainActivity extends FragmentActivity implements
ActionBar.TabListener {
private String[] tabs = { "Recent News", "All News" };
private TabsPagerAdapter mAdapter;
private ViewPager viewPager;
ActionBar.Tab tab;
private AdView mAdView;
private ActionBar bar;
public static final String PREFS_NAME = "MyPrefsFile1";
public CheckBox dontShowAgain;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
viewPager = (ViewPager) findViewById(R.id.pager);
getActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
bar = getActionBar();
bar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.header)));
bar.setStackedBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.header)));
getActionBar().setIcon(new ColorDrawable(getResources().getColor(android.R.color.transparent)));
mAdapter = new TabsPagerAdapter(getSupportFragmentManager());
viewPager.setAdapter(mAdapter);
//tab added in action bar
for(String tab_name:tabs)
{
tab = getActionBar().newTab();
tab.setText(tab_name);
tab.setTabListener(this);
getActionBar().addTab(tab);
}
答案 0 :(得分:0)
添加此代码可能会对您有所帮助
TextView txt1= (TextView) tabHost.getTabWidget().getChildAt(0).findViewById(android.R.id.TextView1);
txt1.setTextSize(25);