zhangzhun132 / notchtools Goto Github PK
View Code? Open in Web Editor NEW💥💥Android刘海屏适配方案---NotchTools,适配国内四大厂商(华为、小米、oppo、vivo)刘海屏手机,根据自己业务需求,提供多种接入方式适配刘海屏。
Home Page: https://www.jianshu.com/p/f04f066a626d
💥💥Android刘海屏适配方案---NotchTools,适配国内四大厂商(华为、小米、oppo、vivo)刘海屏手机,根据自己业务需求,提供多种接入方式适配刘海屏。
Home Page: https://www.jianshu.com/p/f04f066a626d
貌似跟这个 AndroidBug5497 有点冲突 ,可以支持下吗
横屏时这里得到的是0,应该增加判断当前是否是横屏。以下仅仅是简单的修改横屏时应该取的高,最好能根据屏幕的旋转角度来获取对应的安全区域值。
PVersionNotchScreen
@RequiresApi(api = 28)
@Override
public int getNotchHeight(Window window) {
int notchHeight = 0;
WindowInsets windowInsets = window.getDecorView().getRootWindowInsets();
if (windowInsets == null) {
return 0;
}
DisplayCutout displayCutout = windowInsets.getDisplayCutout();
if (displayCutout == null || displayCutout.getBoundingRects() == null) {
return 0;
}
// 修改方式之一
boolean isPortrait = window.getDecorView().getContext().getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT;
notchHeight = isPortrait ? displayCutout.getSafeInsetTop() : displayCutout.getSafeInsetLeft();
return notchHeight;
}
设置全屏后,状态栏的图标应该都被顶上去了,什么也看不到,有没有什么方法可以显示状态栏图标呢?
刘海屏时打开界面先是非全屏,然后再全屏这样会导致界面跳动。
正常吗?
同上
Android 10,
使用PVersionNotchScreen, WindowInsets是空指针, 得到isNotchScreen是false
使用HuaWeiNotchScreen, isNotchScreen是true
华为并没有好好适配android10
onNeedAddNotchStatusBar 这个方法,你的readme.me 写的很清楚,代码里却没有.你别吓唬我啊.
目前好像无法获取屏幕的裁剪坐标
楼主看下,三星 S10+ 安卓9.0系统 失效;
Vivo, Oppo 如果设置app默认全屏不使用刘海,此时再使用”全屏不占用刘海屏区域”会在出现2倍的黑边
横屏,刘海区不显示内容测试有Bug
获取刘海高度是0
@zhangzhun132
/NotchTools/app/src/main/java/com/geek/notchtools/BaseActivity.java:32: error: cannot find symbol
NotchTools里面没有NotchTools.NOTCH_CONTAINER, 忘记上传代码了吗?哈哈
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.