We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
三方应用口袋故事在华为P40多窗口模式下,字体显示异常。 口袋故事使用的是autosize库,当前设置: 且调整design_width_in_dp的值,在多窗口模式下显示字体大小未发生变化,得出结论,autosize未生效。
AutoSize.java 290行,setDensity方法中 DisplayMetrics activityDisplayMetrics = activity.getResources().getDisplayMetrics(); setDensity(activityDisplayMetrics, density, densityDpi, scaledDensity, xdpi); 这行对于activity.getResources()的DisplayMetrics未生效 根因: Android源码中getDisplayMetrics是ResourcesImpl中持有的mMetrics对象,华为EMUI代码中针对多窗口做了兼容性修改,在多窗口中返回的并非是ResourcesImpl中持有的mMetrics,而是其copy对象。直接修改copy对象中的属性无法生效。
能否在设置density的时候,通过updateConfiguration接口确保更新 样例代码: DisplayMetrics displayMetrics = getResources().getDisplayMetrics(); int ratio = configuration.densityDpi / (int)displayMetrics.density; displayMetrics.density += 0.1f; Configuration configuration = getResources().getConfiguration(); configuration.densityDpi = (int) (displayMetrics.density * ratio); getResources().updateConfiguration(configuration,displayMetrics); ### Others:
The text was updated successfully, but these errors were encountered:
我也发现了这个问题,在多窗口的车机上,无法修改density 。
Sorry, something went wrong.
试试覆盖 getResources 返回一个经过代理的 Resources 对象给 View对象,让 View 中拿到的 mMetrics 对象和 setDensity 的 mMetrics 对象是用一个
#1 (comment)
@SweetSun1993 最后此问题则呢么解决处理的?可否提供下思路或者示例代码
No branches or pull requests
Environment
Bug Description:
三方应用口袋故事在华为P40多窗口模式下,字体显示异常。
口袋故事使用的是autosize库,当前设置:
且调整design_width_in_dp的值,在多窗口模式下显示字体大小未发生变化,得出结论,autosize未生效。
Log:
Screenshot
Related Code:
The text was updated successfully, but these errors were encountered: