We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2211

Summary: Change Android Layout from Absolute to Linear or Relative
Product: SDL Reporter: Gabriel Jacobo <gabomdq>
Component: videoAssignee: Gabriel Jacobo <gabomdq>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: enhancement    
Priority: P2 CC: philipp.wiesemann
Version: HG 2.1   
Hardware: All   
OS: Android (All)   
Attachments: patch for using RelativeLayout on Android

Description Gabriel Jacobo 2013-11-06 14:32:55 UTC
This would allow for a more consistent on screen keyboard detection on Android.
See the discussion on bug #1639 for more details.
Comment 1 Philipp Wiesemann 2013-11-23 23:33:45 UTC
Created attachment 1470 [details]
patch for using RelativeLayout on Android

I added a patch with AbsoluteLayout changed to RelativeLayout. For me it looks the same but I have not tried it on lots of devices.
Comment 2 Gabriel Jacobo 2013-11-24 11:46:28 UTC
Cool, can you add the keyboard presence detection logic like we discussed in #1639 ?
Comment 3 Philipp Wiesemann 2013-11-24 20:56:14 UTC
(In reply to Gabriel Jacobo from comment #2)
> Cool, can you add the keyboard presence detection logic like we discussed in
> #1639 ?

If you think of the onMeasure() workaround then I currently prefer not to implement it myself. For me it looks very fragile and I do not fully understand it which means I may mess it up. I do not want to just copy source from stackoverflow.com and hope for the best.

As far as I can tell RelativeLayout is no requirement for this workaround. If android:windowSoftInputMode="adjustResize" is added to AndroidManifest.xml AbsoluteLayout and RelativeLayout resize if the screen keyboard is shown. onMeasure() is called then but also if the device is rotated. Sometimes it is called more than once which I think may confuse the heuristic (what this workaround is).

In my opinion AbsoluteLayout may be replaced with RelativeLayout because AbsoluteLayout it is deprecated. Also some SDL users seem to replace it in their applications anyway because it does not work correctly with ads or so they want display.
Comment 4 Philipp Wiesemann 2016-07-27 19:07:25 UTC
This patch is now: https://hg.libsdl.org/SDL/rev/1b5a21b3fa97