如何改变文本大小在默认android滑动标签



我想增加我的标签使用默认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);
         }

添加此代码可能会对您有所帮助

 TextView txt1= (TextView) tabHost.getTabWidget().getChildAt(0).findViewById(android.R.id.TextView1);
 txt1.setTextSize(25);

最新更新