Giter Club home page Giter Club logo

Comments (22)

JessYanCoding avatar JessYanCoding commented on August 17, 2024

框架日志

from androidautosize.

ivenchan avatar ivenchan commented on August 17, 2024

08-23 14:19:52.786 26914-26914/me.jessyan.autosize.demo D/AndroidAutoSize: me.jessyan.autosize.demo.MainActivity used the global configuration.
08-23 14:19:52.787 26914-26914/me.jessyan.autosize.demo D/AndroidAutoSize: The me.jessyan.autosize.demo.MainActivity has been adapted!
MainActivity Info: isBaseOnWidth = true, designWidthInDp = 360.000000, targetDensity = 3.000000, targetScaledDensity = 3.000000, targetDensityDpi = 480
08-23 14:19:57.519 26914-26914/me.jessyan.autosize.demo D/AndroidAutoSize: me.jessyan.autosize.demo.CustomAdaptActivity implemented by me.jessyan.autosize.internal.CustomAdapt!
08-23 14:19:57.520 26914-26914/me.jessyan.autosize.demo D/AndroidAutoSize: The me.jessyan.autosize.demo.CustomAdaptActivity has been adapted!
CustomAdaptActivity Info: isBaseOnWidth = false, designHeightInDp = 667.000000, targetDensity = 2.935532, targetScaledDensity = 2.935532, targetDensityDpi = 469

from androidautosize.

JessYanCoding avatar JessYanCoding commented on August 17, 2024

2160-(667*2.935532) = 202,屏幕高度被减去了 202 像素,测量下状态栏高度,和导航栏高度,看下 202 像素是怎么来的

from androidautosize.

ivenchan avatar ivenchan commented on August 17, 2024

调用楼主的方法:ScreenUtils.getHeightOfNavigationBar(context) = 130
ScreenUtils.getStatusBarHeight() = 72
刚好是202像素

from androidautosize.

ivenchan avatar ivenchan commented on August 17, 2024
public int getScreenHeight() {

// return isUseDeviceSize() ? mScreenHeight : mScreenHeight - ScreenUtils.getStatusBarHeight() - 、
// ScreenUtils.getHeightOfNavigationBar(getApplication());
return isUseDeviceSize() ? mScreenHeight : mScreenHeight - ScreenUtils.getStatusBarHeight();
}
把计算getHeightOfNavigationBar这个去掉就正常,估计要判断是否隐藏NavigationBar或者StatusBar来计算

from androidautosize.

JessYanCoding avatar JessYanCoding commented on August 17, 2024

这个方法,我这里测试是有导航栏,则返回导航栏的高度,无则返回 0,你能否帮我测试下你的机型能否找到可用的方法能测试导航栏是否存在,以及获取导航栏高度

from androidautosize.

ivenchan avatar ivenchan commented on August 17, 2024

小米的这个方法可以 Settings.Global.getInt(context.getContentResolver(), "force_fsg_nav_bar", 0) != 0
true为全面屏手势,false就正常。不知道其它全面屏手机是否这样判断。

from androidautosize.

JessYanCoding avatar JessYanCoding commented on August 17, 2024

兄弟判断全屏手势来确定导航栏,这个不太严谨,有没有能确定在开启全屏手势后导航栏是否可见的方法
而且我猜测这个问题是,在你切换全屏手势时原本存在的导航栏,消失了,但是又没执行 onCreate 刷新之前的布局,所以之前的布局还是减去了导航栏的高度,所以有空隙

from androidautosize.

ivenchan avatar ivenchan commented on August 17, 2024

不存在刷新的问题,我手机一直是用全面屏的。去看了小米开发者官网,也没有这方面的API调用。

from androidautosize.

JessYanCoding avatar JessYanCoding commented on August 17, 2024

我意思是你是在这个页面打开并且适配完毕后,开的全面屏手势,还是最开始页面没打开就已经开启了全面屏手势

from androidautosize.

ivenchan avatar ivenchan commented on August 17, 2024

开始页面没打开就已经开启了全面屏手势,就是一直都是全面屏的。

from androidautosize.

ivenchan avatar ivenchan commented on August 17, 2024

可以先判断全屏手势是否开启,如果开启即没有导航栏,否则再判断是否有导航栏。这个不知道是不是小米SDK问题,按道理开启全面屏手势,就应该没有导航栏。

from androidautosize.

JessYanCoding avatar JessYanCoding commented on August 17, 2024

意思就是返回状态栏高度的方法是,全面屏就默认返回0

from androidautosize.

ivenchan avatar ivenchan commented on August 17, 2024

我只是测试小米是这样,其它手机不知道。有待验证。

from androidautosize.

ivenchan avatar ivenchan commented on August 17, 2024

https://www.v2ex.com/t/470543

from androidautosize.

JessYanCoding avatar JessYanCoding commented on August 17, 2024

兄弟代码我提交了,帮忙测试下,本地依赖最新代码,现在可以适配了吗

from androidautosize.

ivenchan avatar ivenchan commented on August 17, 2024

可以了,但是楼主是否要判断一下是不是小米手机。其它蓝绿大厂不知道是不是这样判断。

from androidautosize.

JessYanCoding avatar JessYanCoding commented on August 17, 2024

@ivenchan 我测试了其他,手机都是返回 false,应该没问题,而且我感觉其他全面屏手机,也不排除会学习小米的全面屏手势,并且以这个方式来返回是否开启全面屏手势

from androidautosize.

ChaiJiangpeng avatar ChaiJiangpeng commented on August 17, 2024

@JessYanCoding 我的手机是小米mix3 运行demo Autosize Version: 1.0.6;全面屏手势下 底部还有白边,就是导航栏的高度130;

from androidautosize.

JessYanCoding avatar JessYanCoding commented on August 17, 2024

@ChaiJiangpeng 自己改一个正确的屏幕高度 AutoSizeConfig#setScreenHeight

from androidautosize.

ChaiJiangpeng avatar ChaiJiangpeng commented on August 17, 2024

嗯,ScreenUtils.getScreenSize(Context context)在小米上不管是否开启全面屏,高度不变,一直都是减去导航栏的高度

from androidautosize.

JessYanCoding avatar JessYanCoding commented on August 17, 2024

@ChaiJiangpeng v1.0.6 已经优化了这个地方

from androidautosize.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.