Before Flutter draws its first frame, the native host can display a launch background. This older implementation used Android resources for that initial screen and removed the fullscreen flag after layout.
Historical embedding. These snippets use the original
io.flutter.app.FlutterActivityintegration. They have not been migrated to a current Flutter/Android embedding or rebuilt.
Android launch resources
The source placed the image in drawable resources and configured launch_background.xml:
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@android:color/white" />
<!-- You can insert your own image assets here -->
<item>
<bitmap
android:gravity="center"
android:src="@drawable/ic_launcher_background" />
</item>
</layer-list>
Its launch theme temporarily requested fullscreen behavior:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
<item name= "android:windowFullscreen">true</item>
</style>
</resources>
Restore the normal window
The Kotlin and Java variants removed that flag after the Flutter view’s global-layout callback:
import android.os.Build
import android.os.Bundle
import android.view.ViewTreeObserver
import android.view.WindowManager
import io.flutter.app.FlutterActivity
import io.flutter.plugins.GeneratedPluginRegistrant
class MainActivity : FlutterActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
//make transparent status bar
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
window.statusBarColor = 0x00000000
}
GeneratedPluginRegistrant.registerWith(this)
//Remove full screen flag after load
val vto: ViewTreeObserver = flutterView.viewTreeObserver
vto.addOnGlobalLayoutListener(object : ViewTreeObserver.OnGlobalLayoutListener {
override fun onGlobalLayout() {
flutterView.viewTreeObserver.removeOnGlobalLayoutListener(this)
window.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN)
}
})
}
}
import android.os.Build;
import android.os.Bundle;
import android.view.ViewTreeObserver;
import android.view.WindowManager;
import io.flutter.app.FlutterActivity;
import io.flutter.plugins.GeneratedPluginRegistrant;
public class MainActivity extends FlutterActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//make transparent status bar
getWindow().setStatusBarColor(0x00000000);
GeneratedPluginRegistrant.registerWith(this);
//Remove full screen flag after load
ViewTreeObserver vto = getFlutterView().getViewTreeObserver();
vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
getFlutterView().getViewTreeObserver().removeOnGlobalLayoutListener(this);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
});
}
}
System-bar behavior and keyboard resizing need to be reviewed together; a launch-screen flag should not inadvertently remain part of the ordinary form layout.
The earlier iOS asset note
Open Runner.xcworkspace -> Runner -> Runner -> Assets.scassets -> LaunchImage -> Upload 3 type res
That line records the old Xcode asset workflow, including its original path spelling. It does not establish the launch-screen requirements of a current iOS application.