Display a FlutterFragment with transparency

By default, FlutterFragment renders with an opaque background,
using a SurfaceView. (See “Control FlutterFragment’s render
mode.”) That background is black for any pixels that aren’t
 painted by Flutter. Rendering with an opaque background is
the preferred rendering mode for performance reasons.
Flutter rendering with transparency on Android negatively
affects performance. However, there are many designs that
require transparent pixels in the Flutter experience that
show through to the underlying Android UI. For this reason,
Flutter supports translucency in a FlutterFragment.

To enable transparency for a FlutterFragment,
build it with the following configuration:

Java

Kotlin

// Using a new FlutterEngine.

FlutterFragment

flutterFragment

FlutterFragment

withNewEngine

()

transparencyMode

FlutterView