Android split screen to run two apps stage height problem
Problem Description
On Android when I run two apps using split screen simultaneously, stage height can change.
- AIR SDK 51.2.2.6
- Android 16
- I reproduce it on Pixel 7 Pro and Pixl 10 Pro
Steps to Reproduce
Image 1 : without spleet screen, stage height is 1080
Image 2 : I split screen using Google Chrome (or other app) and my Air app, stage height is 1080
Image 3 : tap and hold the screen divider line and drag it left, stage height is 1017 ???
Image 4 : tap and hold the screen divider line and drag it right (initial position : Image 2) stage height is 954 ???
minimal code example:
package
{
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.events.MouseEvent;
public class Main extends Sprite
{
private var textField:TextField = new TextField();
public function Main()
{
this.addEventListener(Event.ADDED_TO_STAGE, addedToStageHandler);
}
private function addedToStageHandler(e:Event):void
{
this.removeEventListener(Event.ADDED_TO_STAGE, addedToStageHandler);
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
textField.background = true;
textField.border = true;
textField.y = 80;
textField.width = 500;
textField.height = 200;
var format:TextFormat = new TextFormat();
format.size = 40;
textField.defaultTextFormat = format;
this.addChild(textField);
var sprite:Sprite = new Sprite();
sprite.graphics.beginFill(0x0000FF);
sprite.graphics.drawRect( 0, 0, 200, 200);
sprite.graphics.endFill();
sprite.y = textField.y + textField.height + 20;
sprite.addEventListener(MouseEvent.CLICK, mouseClickHandler);
this.addChild( sprite );
}
private function mouseClickHandler(event:MouseEvent):void
{
textField.text = "\n\nstageHeight : " + stage.stageHeight;
}
}
}
I don't know if it's an Air or Android bug, but it's impossible to use Screen.mainScreen.safeArea if stage height can change...
in Image 2 the top of the stage is under status bar and the bottom of the stage is under navigation bar but that's not the case in Image 4.
I represented the stage bounds in a red rectangle :
Image 2
Image 4
status bar height : 63 navigation bar height : 63 954 + 63 + 63 = 1080
Known Workarounds
no workarounds