如何在默认的android刷卡选项卡中更改文本大小?

时间:2015-10-26 09:32:51

标签: android android-pageradapter

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

1 个答案:

答案 0 :(得分:0)

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

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