2012-07-07 271 views
0

在我的应用程序中,我为所有文本元素设置了固定的字体大小。对于我正在使用的TextSwitcher,我正在设置像这样的字体大小。在显示设置中更改字体大小的Android TextSwitcher大小增加

altitudeSwitcher = (TextSwitcher) findViewById(R.id.altitude); 
     altitudeSwitcher.setFactory(new ViewFactory() { 

      @Override 
      public View makeView() { 
       GradientColor gd = Gradients.AllGradients().get(2); 

       TextView t = new TextView(getApplicationContext()); 
       t.setGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL); 
       t.setTextSize(50); 
       t.setTextColor(gd.getTextColor()); 
       return t; 
      } 
     }); 

但是,在显示设置中将字体大小更改为巨大,它增加了很多大小。我如何设置固定的字体大小?

回答

1

这是一个愚蠢的怀疑。找到了。我不得不像这样设置单位setTextSize(TypedValue.COMPLEX_UNIT_DIP, 50);