Code Monkey home page Code Monkey logo

Comments (3)

lcj0304 avatar lcj0304 commented on August 20, 2024

在华为荣耀7上,也会出现白条的情况

from android-titlebar.

wuhenzhizao avatar wuhenzhizao commented on August 20, 2024

@lcj0304

mChildOfContent.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
            public void onGlobalLayout() {
                if (isfirst) {
                    contentHeight = mChildOfContent.getHeight();//兼容华为等机型
                    isfirst = false;
                }
                possiblyResizeChildOfContent();
            }
        });

改成

mChildOfContent.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
            public void onGlobalLayout() {
                if (isfirst) {
                    contentHeight = mChildOfContent.getRootView().getHeight();//兼容华为等机型
                    isfirst = false;
                }
                possiblyResizeChildOfContent();
            }
        });

之后OK了?

from android-titlebar.

kaka123888 avatar kaka123888 commented on August 20, 2024

一、条件

1、沉浸模式下
2、 红米1s(miui8.5) 和oppo A37m(ColorOS3.0)Android5.1下
3、界面有ScrollView下内嵌有EditText。

Activity 设置:android:windowSoftInputMode="stateHidden|adjustResize"
已经调用
@OverRide
public void onAttachedToWindow() {
super.onAttachedToWindow();
KeyboardConflictCompat.assistWindow(getWindow());
}

二、现象

当进入界面时,界面底部出现白条,高度=状态栏高度

调试发现:

KeyboardConflictCompat.KeyboardConflictCompat() 方法里面
代码
contentHeight = mChildOfContent.getHeight();

假设手机 h=1280px。
在出问题的机型里面,contentHeight = h - statusHeight

没有出现白条的手机,contentHeight = h

我把代码改为:
mChildOfContent.getRootView().getHeight();
都正常。

原因可能某些机型ROM有问题。

我在小米2s(MIUI9.2) 及其它厂商手机上(测试了10手机左右),未见有此现象。
=========================================================================
在mate10 pro,
EMUI版本10.0.0,android版本10的机子上,
还是出现了会出现白条

from android-titlebar.

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.