| | |
| | | @Override |
| | | public Resources getResources() { |
| | | Resources res = super.getResources(); |
| | | // if (res.getConfiguration().fontScale != 1) {//非默认值 |
| | | Configuration newConfig = new Configuration(); |
| | | newConfig.setToDefaults();//设置默认 |
| | | newConfig.fontScale = 1.1f; |
| | | res.updateConfiguration(newConfig, res.getDisplayMetrics()); |
| | | // } |
| | | |
| | | try { |
| | | if (Build.BRAND.toLowerCase().equalsIgnoreCase("xiaomi")) { |
| | | if (res.getConfiguration().fontScale != 1.1) { |
| | | newConfig.fontScale = 1.1f; |
| | | res.updateConfiguration(newConfig, res.getDisplayMetrics()); |
| | | } |
| | | } else { |
| | | if (res.getConfiguration().fontScale != 1) { |
| | | newConfig.fontScale = 1.0f; |
| | | res.updateConfiguration(newConfig, res.getDisplayMetrics()); |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | res.updateConfiguration(newConfig, res.getDisplayMetrics()); |
| | | } |
| | | return res; |
| | | } |
| | | |