-
Notifications
You must be signed in to change notification settings - Fork 26.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flutter PlatformView on Android 6.0 the default background is black #26505
Comments
To investigate we would need a minimal runnable reproduction |
I have the same problem. @zoechi @linuxomk class Demo extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
child: AndroidView(
viewType: 'nativeViewDemo'
),
);
}
} Android code: public class DemoView {
public static void registerWith(Registrar registrar) {
registrar.platformViewRegistry().registerViewFactory("nativeViewDemo", new NativeViewFactory(registrar.messenger()));
}
}
public class NativeViewFactory extends PlatformViewFactory {
private final BinaryMessenger messenger;
public NativeViewFactory(BinaryMessenger messenger) {
super(StandardMessageCodec.INSTANCE);
this.messenger = messenger;
}
@Override
public PlatformView create(Context context, int id, Object args) {
return new NativeView(context, messenger, id);
}
}
class NativeView implements PlatformView {
@Override
public View getView() {
return new FrameLayout();
}
}
Flutter Doctor
The background is darkGray in Android 6.0, but white above 6.0. |
same issue. i used AndroidView to show barrage, its background is white and video below is invisiable |
i solve this temporarily by using reflection .
|
The method @lzdon provided works, but for dynamic content like lottie animation, the animation will fails to clear its frames, resulting in all frames painted one over another. Is there any way to get PlatformView provide a transparent background by default? |
I'm trying to use flutter_lottie plugin and it gives me gray background color on android. Could someone please provide a workaround for this? |
Since i can't use flutter_lottie,it gives me white background color on android,I have to replac all lottie animation with videos,Could someone please help me? |
@coltorchen since I don't have the specific device with 6.0 OS to verify this, but can you confirm if this is still a valid issue using latest Flutter version ? |
Without additional information, we are unfortunately not sure how to resolve this issue. Could everyone who still has this problem please file a new issue with the exact description of what happens, logs, and the output of |
Hi am currently facing this same issue, I want to show a widget from native and make the Android view background transparent, i tried on mobile device and it works fine, but when run on android tv marshmallow 6.0 API level 23, the background is always black. I am using flutter 1.22.6 and i also tried the method provided by @lzdon; it throws an exception |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
i try to use PlatformView to expose a native Android ListView as a Flutter Widget.
when i run example on Android 7.0+,ListView background looks good.
(Mobile device: Redmi Note 4X - MIUI 9.6 - Android 7.0)
but when i run example on Android 6.0, ListView background is black, maybe the background color's alpha is 0 ?
(Mobile device: Redmi Note 4 - MIUI 10 - Android 6.0 )
#######################################################################
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
The text was updated successfully, but these errors were encountered: