mikepenz / MaterialDrawer

The flexible, easy to use, all in one drawer library for your Android project. Now brand new with material 2 design.

Home Page:https://mikepenz.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

adjustResize not working

tgivslife opened this issue · comments

commented

When you have a fragment with editText in it inside a scrollview and also a Navigation Drawer, when you focus the editText you can't scroll the contents of the fragment and the editText ends up behind the keyboard. If I remove the Navigation Drawer the editText is placed above keyboard and I can also scroll to view rest of content. This only happens on Lollipop.

commented

I found the problem. Its the translucent status bar. When its enabled you set the flag SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN

 if (Build.VERSION.SDK_INT >= 19) {
                if (mTranslucentStatusBarProgrammatically) {
                    mActivity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
                }
            }

When I set withTranslucentStatusBar(false) the adjustResize is working again and I can scroll the layout when the keyboard is shown.

@NamingException yeah this is a known behavior of this FLAG. So i've implemented a util which will enable support for keyboards and this behavior. It lowers the layout size and adds enough padding to the bottom.

You can enable this by calling .keyboardSupportEnabled(activity, enabled) on the Drawer.Result.
The sample application also contains a sample with this in use

Hi,

I had same issue, and it took me some time to find this question.
.keyboardSupportEnabled(activity, enabled) worked well with .withTranslucentStatusBar(true) .
Maybe this should be in the document? Soft keyboard is used a lot.

Only one small problem, it will show a blue (colorPrimary) background before soft keyboard appear, which won't happen with .withTranslucentStatusBar(false) .

I upload a video to show the problem.
https://youtu.be/tc158Otf5II

@GreenSkinMonster to get it working i've created the keyboardSupport function. It is in the sample app. The thing is that in fact this is no issue of the MaterialDrawer. It's Android functionality, and people don't know about this. There were other issues regarding this. If you have FullScreen the adjustResize won't work anymore.

So to "fix" it i will resize the layout. as far as i can, i can't fix the display. the blue is your background color so you can change this.

@mikepenz Thank you for the reply and document update.
Sorry I missed those discussions.
I think they answered my question.

This a great project with great support.
Thanks.

@GreenSkinMonster no problem.

Thanks ;)