未验证 提交 108e0a64 编写于 作者: M Michael Klimushyn 提交者: GitHub

Add transparency helpers to FlutterView.java (#6172)

Fixes #9627
上级 f6ad3e09
......@@ -12,6 +12,7 @@ import android.content.IntentFilter;
import android.content.pm.ApplicationInfo;
import android.content.res.Configuration;
import android.database.ContentObserver;
import android.graphics.PixelFormat;
import android.provider.Settings;
import android.net.Uri;
import android.os.Handler;
......@@ -276,6 +277,26 @@ public class FlutterView extends SurfaceView
mFirstFrameListeners.remove(listener);
}
/**
* Updates this to support rendering as a transparent {@link SurfaceView}.
*
* Sets it on top of its window. The background color still needs to be
* controlled from within the Flutter UI itself.
*/
public void enableTransparentBackground() {
setZOrderOnTop(true);
getHolder().setFormat(PixelFormat.TRANSPARENT);
}
/**
* Reverts this back to the {@link SurfaceView} defaults, at the back of its
* window and opaque.
*/
public void disableTransparentBackground() {
setZOrderOnTop(false);
getHolder().setFormat(PixelFormat.OPAQUE);
}
public void setInitialRoute(String route) {
mFlutterNavigationChannel.invokeMethod("setInitialRoute", route);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册