2015-10-26 123 views
0

我想提高我的標籤,其使用默認的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); 
     } 
+0

你必須以編程方式進行。檢查這裏 - > http://stackoverflow.com/questions/5788971/how-to-change-the-font-size-of-tabhost-in-android http://stackoverflow.com/questions/12624175/change-文字大小上,tabhost –

回答

0

添加該代碼可能是它可以幫助你

代碼
TextView txt1= (TextView) tabHost.getTabWidget().getChildAt(0).findViewById(android.R.id.TextView1); 
txt1.setTextSize(25); 
相關問題