Android How to adjust layout in Full Screen Mode when softkeyboard is visible

前端 未结 25 1743
后悔当初
后悔当初 2020-11-22 03:56

I have researched a lot to adjust the layout when softkeyboard is active and I have successfully implemented it but the problem comes when I use android:theme=\"@andro

25条回答
  •  你的背包
    2020-11-22 04:54

    Since the answer has already been picked and problem known to be a bug, I thought I would add a "Possible Work Around".

    You can toggle fullScreen mode when soft keyboard is shown. This allows the "adjustPan" to work correctly.

    In other words, I still use @android:style/Theme.Black.NoTitleBar.Fullscreen as part of the application theme and stateVisible|adjustResize as part of the activity window soft input mode but to get them to work together I must toggle fullscreen mode before the keyboard comes up.

    Use the following Code:

    Turn Off full screen mode

    getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
    getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    

    Turn On full screen mode

    getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
    

    Note - inspiration came from: Hiding Title in a Fullscreen mode

提交回复
热议问题