问题
I am able to play GIF image in Xamarin.Forms (Portable) but now I need to remove the background of the WebView. So, that it will look pretty good.
Here is the link for the GIF player in Xamarin.Forms (Portable)
回答1:
As Yuri S already mentioned, you shouldn't be using the WebView. It's an overkill for such a simple task as showing a GIF animation. Instead, you should look at the GifImageView control by James Montenegro. It extends the default Image control with GIF capabilities using custom renderers for iOS and Android.
If you really want to use the WebView, you need to write your own custom renderer for each platform to achieve true transparency.
iOS: Set the Opaque
property to false and make sure that the background color is UIColor.Clear. The default implementation of Xamarin.Forms WebView already has the background color set, so you only need to take care of the Opaque property.
Android: Set the BackgroundColor
property of the WebView to 0x00000000
PCL: Make sure that the body of your HTML page has a transparent background. Otherwise it will be white and the transparency setting of your underlying WebView doesn't matter. <body style="background-color: transparent;">
来源:https://stackoverflow.com/questions/42137722/transparent-background-of-webview-in-xamarin-forms-portable