Home  >  Q&A  >  body text

android怎么解决app的字体大小随着手机设置的字体大小改变的现象?

  1. 描述你的问题
    刚做完的项目,事先没想到,后来有用户反馈内容没显示完整,最后发现他手机设置里面把字体大小调到最大了,字体调小之后就正常。现在是用这个方法不让app里面的字体大小改变,想问下有没有别的方法可以解决。

  2. 贴上相关代码
    @Override
    public Resources getResources() {

       // TODO Auto-generated method stub
       Resources res = super.getResources();
       Configuration config = new Configuration();
       config.setToDefaults();
       res.updateConfiguration(config, res.getDisplayMetrics());
       return res;

    }

巴扎黑巴扎黑2758 days ago831

reply all(3)I'll reply

  • 天蓬老师

    天蓬老师2017-04-17 15:44:33

    textSize uses dp as the unit
    But it is not recommended to do this. To solve your problem, it is better to make the textview size adaptive and scrollable

    reply
    0
  • PHPz

    PHPz2017-04-17 15:44:33

    Is this your question template for trolling? Why were the three, four and five points sent out without completing them?

    reply
    0
  • 天蓬老师

    天蓬老师2017-04-17 15:44:33

    The font size unit is dp

    reply
    0
  • Cancelreply