Skip to content
New issue

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

华为mate10 9.0 不适配问题 #109

Closed
5 tasks done
fishboil opened this issue Dec 24, 2018 · 2 comments
Closed
5 tasks done

华为mate10 9.0 不适配问题 #109

fishboil opened this issue Dec 24, 2018 · 2 comments

Comments

@fishboil
Copy link

fishboil commented Dec 24, 2018

在华为mate10上使用该框架,日志显示改变了targetDensity 等参数,但在onResume页面打印,参数并未更改成功,页面布局也没有自动适配,android环境为 9.0.

com.sykj.iot.view.device.lamp.LampActivity has been adapted!
LampActivity Info: isBaseOnWidth = false, designHeightInDp = 667.000000, designHeightInSubunits = 667.000000, targetDensity = 2.602699, targetScaledDensity = 2.602699, targetDensityDpi = 416, targetXdpi = 2.602699

12-24 14:53:39.347 24711-24711/com.sykj.iotdev I/LampActivity: dm.density=[3.0] dm.densityDpi=[480]
12-24 14:53:39.347 24711-24711/com.sykj.iotdev I/LampActivity: dm.widthPixels=[1080] dm.heightPixels=[1808]

Environment

  • Autosize Version:
  • Device Model:
  • Target Android Version:
  • Device Resolution:
  • Design Size On AndroidManifest:

Bug Description:

Log:


12-24 14:53:39.337 24711-24711/com.sykj.iotdev D/AndroidAutoSize: com.sykj.iot.view.device.lamp.LampActivity onAdaptBefore!
12-24 14:53:39.337 24711-24711/com.sykj.iotdev D/AndroidAutoSize: com.sykj.iot.view.device.lamp.LampActivity used the global configuration.
12-24 14:53:39.339 24711-24711/com.sykj.iotdev D/AndroidAutoSize: The com.sykj.iot.view.device.lamp.LampActivity has been adapted! 
                                                                  LampActivity Info: isBaseOnWidth = false, designHeightInDp = 667.000000, designHeightInSubunits = 667.000000, targetDensity = 2.602699, targetScaledDensity = 2.602699, targetDensityDpi = 416, targetXdpi = 2.602699

Screenshot

Related Code:

      AutoSizeConfig.getInstance().setCustomFragment(true)  //屏幕适配监听器
                .setOnAdaptListener(new onAdaptListener() {
                    @Override
                    public void onAdaptBefore(Object target, Activity activity) {
                        //使用以下代码, 可支持 Android 的分屏或缩放模式, 但前提是在分屏或缩放模式下当用户改变您 App 的窗口大小时
                        //系统会重绘当前的页面, 经测试在某些机型, 某些情况下系统不会重绘当前页面, ScreenUtils.getScreenSize(activity) 的参数一定要不要传 Application!!!
//                        AutoSizeConfig.getInstance().setScreenWidth(ScreenUtils.getScreenSize(activity)[0]);
//                        AutoSizeConfig.getInstance().setScreenHeight(ScreenUtils.getScreenSize(activity)[1]);
                        LogUtils.d(String.format(Locale.ENGLISH, "%s onAdaptBefore!", target.getClass().getName()));
                    }

                    @Override
                    public void onAdaptAfter(Object target, Activity activity) {
                        LogUtils.d(String.format(Locale.ENGLISH, "%s onAdaptAfter!", target.getClass().getName()));
                    }
                }).setUseDeviceSize(false).setBaseOnWidth(false);

Others:

@JessYanCoding
Copy link
Owner

#13 (comment)

@gs666
Copy link

gs666 commented Sep 4, 2023

我也遇到了这个问题,华为手机好像就是诡异的事比较多==

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants