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

虚拟导航栏适配问题 #446

Open
FrankLove opened this issue Jul 31, 2023 · 1 comment
Open

虚拟导航栏适配问题 #446

FrankLove opened this issue Jul 31, 2023 · 1 comment

Comments

@FrankLove
Copy link

FrankLove commented Jul 31, 2023

你好,请问我的应用是横屏的app,设计稿是:1024dp * 738dp,使用这个适配方案在平板上如果底部有导航栏的话就会出现顶部一部分界面显示不全的问题,并且只有这一个页面有问题,其他都正常的。如果把导航栏隐藏掉则正常,
如图
image
参考这个issue 修改高度,好像没有任何作用,请问这是什么原因呢?
手机底部有虚拟导航栏和全屏时候不适配 #125

Environment

Log:

MainActivityV4 Info: isBaseOnWidth = true, designWidthInDp = 1024.000000, designWidthInSubunits = 1024.000000, targetDensity = 1.875000, targetScaledDensity = 1.875000, targetDensityDpi = 300, targetXdpi = 1.875000, targetScreenWidthDp = 1024, targetScreenHeightDp = 533

Screenshot

Related Code:

在MainApplication 里面添加如下代码

          AutoSizeConfig.getInstance()
                //屏幕适配监听器
                .setOnAdaptListener(new onAdaptListener() {
                    @Override
                    public void onAdaptBefore(Object target, Activity activity) {
                        //ScreenUtils.getScreenSize(activity) 的参数一定要不要传 Application!!!

                        if (activity.getLocalClassName().contains("MainActivityV4"))
                        {
                            KLog.i(" MainActivityV4 "+(ScreenUtils.getScreenSize(activity)[1])+" "+BarUtils.getNavBarHeight()+" "+ com.blankj.utilcode.util.ScreenUtils.getScreenHeight());
                            AutoSizeConfig.getInstance().setScreenWidth(ScreenUtils.getScreenSize(activity)[0]);
                            AutoSizeConfig.getInstance().setScreenHeight(ScreenUtils.getScreenSize(activity)[1]-BarUtils.getNavBarHeight());
                        }

                    }

                    @Override
                    public void onAdaptAfter(Object target, Activity activity) {
                    }
                });

Others:

@JessYanCoding
Copy link
Owner

可能修改屏幕高度时,获取的导航栏高度,不是适配后的高度

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

2 participants