Bug 45215 - AdjustResize Causes Content to Be Sized Incorrectly After Toggling Keyboard
Summary: AdjustResize Causes Content to Be Sized Incorrectly After Toggling Keyboard
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Android (show other bugs)
Version: 2.3.4
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Jimmy [MSFT]
URL:
: 55558 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-10-08 19:24 UTC by Luigi Maestrelli
Modified: 2017-09-06 06:37 UTC (History)
17 users (show)

Tags: ac android adjustresize sizing, fr
Is this bug a regression?: No
Last known good build:


Attachments
Sample (199.16 KB, application/rar)
2016-10-08 19:24 UTC, Luigi Maestrelli
Details
ActionBar space (291.02 KB, image/png)
2017-01-13 20:10 UTC, Luigi Maestrelli
Details
Entry resize problem (174.61 KB, application/x-rar)
2017-01-17 18:16 UTC, Luigi Maestrelli
Details
Another sample (322.30 KB, application/x-rar)
2017-02-14 19:47 UTC, Luigi Maestrelli
Details
repro project (47.40 KB, application/x-zip-compressed)
2017-04-25 19:21 UTC, Jimmy [MSFT]
Details
Reproduction project for Editor inside ListView Cell issue (53.18 KB, application/zip)
2017-08-31 08:48 UTC, Anton
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Luigi Maestrelli 2016-10-08 19:24:35 UTC
Created attachment 17947 [details]
Sample

On a StackLayout filled with a ListView and an Entry on the botton.
The the keyboard appears, and the ListView overlaps all the NavigationBar and the StatusBar.

To reproduce, run the sample and tap the Entry. The View should not be just scrolled up.
Comment 1 adrianknight89 2016-10-10 20:48:35 UTC
https://github.com/xamarin/Xamarin.Forms/pull/422 might fix your issue (After this PR is merged, you will need to switch to adjust resize if needed.)
Comment 2 Chris King 2016-10-21 16:32:47 UTC
confirmed; clicking on the entry has the effect of shifting everything on screen up which overlaps the NavigationBar.
Comment 3 Jimmy [MSFT] 2017-01-13 19:47:42 UTC
By default, Forms uses AdjustPan for its input mode so the screen content is pushed upwards to keep the Entry in view.

If you want the content to resize instead and not cover the navbar, you need to set the input mode to AdjustResize using the Platform Specifics feature introduced in Forms 2.3.3: https://developer.xamarin.com/guides/xamarin-forms/user-interface/platform-specifics/consuming/#Setting_the_Soft_Keyboard_Input_Mode

The Platform Specifics code can be added in your shared/PCL code or in MainActivity after LoadApplication(). I tested it with the attached project and it resolved the issue described.
Comment 4 Luigi Maestrelli 2017-01-13 20:10:19 UTC
That solved the resize problem, but now the app is not at the top of the screen. There is black space just like the image on the guide.

Is it possible to remove?

I will attach a image to better explain.
Comment 5 Luigi Maestrelli 2017-01-13 20:10:47 UTC
Created attachment 19334 [details]
ActionBar space
Comment 6 Jimmy [MSFT] 2017-01-14 00:17:37 UTC
This is due to an underlay Forms adds to the status bar in Lollipop and above. It is possible to remove using the workaround here: https://gist.github.com/jimmgarrido/e36033b26f01e8da091fd321d41d991a#file-forms-2-3-3-L8
Comment 7 Luigi Maestrelli 2017-01-17 18:16:05 UTC
The last comment solved the problem.
But, with the Resize option other layouts are resizing incorrectly when the keyboard appears and disappears.

To simulate a the problem we have this page:

 - ScrollView
 -- StackLayout
 --- Entry 1
       VerticalOption Start
 --- Entry 2
       VerticalOption Start
 --- Entry 3
       VerticalOption Start
 --- Editor
       VerticalOption FillAndExpand
 --- StackLayout
       VerticalOption End
 ---- Some data (labels and images)

When I tap the Editor and then close the keyboard, the Editor no longer fill the page vertically.
Looks like the page page is not resizing after the keyboard is dismissed.

Found out that another guy has the same problem here: 
https://forums.xamarin.com/discussion/86681/scrollview-with-editor-inside-bug
Comment 8 Luigi Maestrelli 2017-01-17 18:16:37 UTC
Created attachment 19367 [details]
Entry resize problem

Repo for the last comment
Comment 9 Paul DiPietro [MSFT] 2017-01-26 22:51:06 UTC
I updated the issue title to better reflect what's now being reported rather than opening a new bug. Thank you for the reproduction.
Comment 10 Luigi Maestrelli 2017-02-14 19:47:20 UTC
Created attachment 19816 [details]
Another sample

Any news on this?
The layout breaks on every user action.

This reproduction sample shows that this is happening on navigations as well
Comment 11 Guilherme Waltricke 2017-03-09 14:07:23 UTC
The same problem here, Xamarin this will not be fixed? 4 months? that's been hard to work with XF with the quantity of bugs that appear...
Comment 12 Luigi Maestrelli 2017-03-23 12:23:53 UTC
Almost 6 months now and nothing.
If a client of mine had a unsolved bug that prevent a release for 6 months, for sure they will fired me...
Comment 13 Jimmy [MSFT] 2017-04-25 19:21:31 UTC
Created attachment 21775 [details]
repro project

This issue is still occurring with Forms 2.3.4 and 2.3.5-pre1. I've consolidated the attached projects into a single one that demonstrates both cases of the issue.


### Scenario 1
If the page content is wrapped in a ScrollView and the keyboard is toggled, when the keyboard is dismissed the page content will not resize back to its original height. To reproduce

1. Run the attached project
2. Tap on any of the three Entry controls to bring up the keyboard
3. Press the back button to dismiss the keyboard


### Scenario 2
The same thing happens when the keyboard is open and the user navigates back to the previous page. In this case, the content of the previous page will be sized as if the keyboard was still open. This happens even if the content is not wrapped in a ScrollView. To reproduce:

1. Run the attached project
2. Press "Go to next page"
3. Tap on the Entry to bring up the keyboard
4. Press the back arrow in the navigation bar (not hardware/soft button) to go back
Comment 14 Jimmy [MSFT] 2017-04-25 19:25:19 UTC
*** Bug 55558 has been marked as a duplicate of this bug. ***
Comment 15 E.Z. Hart [MSFT] 2017-05-19 01:46:14 UTC
PR: https://github.com/xamarin/Xamarin.Forms/pull/927
Comment 16 Luigi Maestrelli 2017-07-07 12:55:29 UTC
Are there any news on this bug?
Comment 17 Michael Donlin 2017-07-10 20:11:39 UTC
Also looking for an update on this bug. Thanks!
Comment 18 E.Z. Hart [MSFT] 2017-07-12 19:18:13 UTC
The PR's been merged, so this fix should be in 2.3.6-pre1.
Comment 19 Leonardo 2017-08-26 13:32:14 UTC
Any dates for the next release? Thanks.
Comment 20 Anton 2017-08-31 08:44:22 UTC
It seems to be fixed in XF 2.4 pre-2 
Btw when navigating back from page with opened keyboard you can see that layout not resized back, than it fills all the page after a less than second.


I experience issue that seems to be related to this one:
1. You have ListView with Editor controls in ViewCells.
2. Focus Editor, keyboard appears and layout pushed to top, even toolbar. That happens even with WindowSoftInputModeAdjust.Resize. Just Editor control, not nested in ListView, not pushes toolbar from screen since it was already fixed.
Is that expected behavior for such control combination or some bug?
Experiences such behavior on XF 2.3.4, 2.3.5, 2.4 pre-2. 

Just in case I'll attach sample project with such behavior.
Comment 21 Anton 2017-08-31 08:48:08 UTC
Created attachment 24496 [details]
Reproduction project for Editor inside ListView Cell issue

Attached project for reproduction issue described above.

Steps to reproduce:
1. Run app
2. There is ListView with Editor in ViewCells. Focus any cell at the bottom of the page.
3. Layout pushed to top with toolbar even if WindowSoftInputModeAdjust.Resize set.

Is that expected behavior or bug?
Comment 22 E.Z. Hart [MSFT] 2017-09-05 20:08:23 UTC
(In reply to Anton from comment #21)
> Created attachment 24496 [details]
> Reproduction project for Editor inside ListView Cell issue
> 
> Attached project for reproduction issue described above.
> 
> Steps to reproduce:
> 1. Run app
> 2. There is ListView with Editor in ViewCells. Focus any cell at the bottom
> of the page.
> 3. Layout pushed to top with toolbar even if
> WindowSoftInputModeAdjust.Resize set.
> 
> Is that expected behavior or bug?

Anton, 

Can you open a separate issue and attach your repro project? Then the support team can confirm whether or not it's a bug or an expected behavior. 

Thanks.
Comment 23 Anton 2017-09-06 06:37:42 UTC
E.Z. Hart, thanks for your reply.
Created new issue:
https://bugzilla.xamarin.com/show_bug.cgi?id=59246
Regards, Anton.