Webview on top of Image renders background color of html always white instead of transparent #15445
Unanswered
ravenrevana
asked this question in
Q&A
Replies: 1 comment
-
I think you need to change the WebView background using handlers like I did with BlazorWebView |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all,
I will try to keep it short. While trying to render a custom html Webview on top or on the same ZIndex as an Image the underlying background color of the html always defaults to white instead of transparent. If you set the ZIndex for example to 0 it works as expected. Any help on this is really appreciated.
<Grid BackgroundColor="Transparent"> <Image ZIndex="1" Source="black.jpg" Aspect="AspectFill" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" Opacity="0.9" BackgroundColor="Transparent" /> <VerticalStackLayout ZIndex="2" BackgroundColor="Transparent"> <WebView MinimumHeightRequest="50" MinimumWidthRequest="200" x:Name="WebView" BackgroundColor="Transparent"> <WebView.Source> <HtmlWebViewSource> <HtmlWebViewSource.Html> <![CDATA[<HTML><style>*{Background: transparent;}</style><BODY>これは<ruby>私<rt>わたし</rt></ruby><span style="color:#ffb7c5">の</span><ruby>妹<rt>いもうと</rt></ruby><span style="color:#ffb7c5">の</span><ruby>写真<rt>しゃしん</rt></ruby>です。</BODY></HTML>]]> </HtmlWebViewSource.Html> </HtmlWebViewSource> </WebView.Source> </WebView> </VerticalStackLayout> </Grid>
P.S. Just before anyone asks the style tag "BackgroundColor="Transparent" makes no difference e.g. I tried it with and without all over the place. The style in the actual HTML "<style>*{Background: transparent;}</style>" can be set to any other color red for example and it works but not to transparent.
Env:
.Net7.0 Windows
Beta Was this translation helpful? Give feedback.
All reactions