TextureView doesn't support displaying a background drawable

Hi all I have a problem in my Xamarin.Forms app that I try to reproduce in my own project, its about this: https://github.com/juniandotnet/xamarin-background-video . But as the title said I hit a bump with the video renderer. Same as this guys I get this error: https://github.com/juniandotnet/xamarin-background-video/issues/1 . Its about this bit of code:

`
var textureView = new TextureView(Context)
{
Background = new ColorDrawable(Xamarin.Forms.Color.Transparent.ToAndroid()),
Visibility = ViewStates.Gone,
LayoutParameters = new LayoutParams(
ViewGroup.LayoutParams.MatchParent,
ViewGroup.LayoutParams.MatchParent),
};

                textureView.SurfaceTextureListener = this;

`

I tried this > It turns out setting your targetSdkVersion to 23 in your AndroidManifest.xml corrects the error but this would mean if you publish your app to the playstore it might get rejected
But as the comment said I can`t upload it to google play so no go... Any ideas?

Best Answer

  • marineataemilmarineataemil ✭✭
    edited September 9 Accepted Answer

    So to anyone having the same problem when trying to do this tutorial: https://github.com/juniandotnet/xamarin-background-video

    The solution is to set the background to null like this:

    var textureView = new TextureView(Context) { Background = null, Visibility = ViewStates.Gone, LayoutParameters = new LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent), };

    Also thank you to @Jarvan for the sugestion.

Answers

Sign In or Register to comment.