나는 안드로이드 플랫폼을 가진 GIF의로드에 붙어 있기 때문에 오늘 올께.Xamarin Forms - WebView Html 소스 문제
그래서public class Gif : WebView
{
public string GifSource
{
set
{
var html = new HtmlWebViewSource();
html.Html = String.Format(@"<html><body style='background: #FF0000;'><img src='{0}' style='width:100%;height:100%;'/></body></html>", "https://media.giphy.com/media/UGifMFmx0gERG/giphy.gif");
Debug.WriteLine("Html.Source = '{0}'", html.Html);
this.Margin = -10;
this.Source = html;
}
get { return (string)GetValue(SourceProperty); }
}
}
난 그냥 내 XAML 측이 Gif
를 선언 :
<AbsoluteLayout AbsoluteLayout.LayoutBounds="0.5, 0.5, 1, 1" AbsoluteLayout.LayoutFlags="All">
<control:Gif
AbsoluteLayout.LayoutBounds="0.5, 0, 1, 0.9"
AbsoluteLayout.LayoutFlags="All"
BackgroundColor="Red"
GifSource="Gifs/LoginBackground.gif" />
<BoxView
AbsoluteLayout.LayoutBounds="0.5, 0.5, 1, 1"
AbsoluteLayout.LayoutFlags="All"
BackgroundColor="Transparent" />
</AbsoluteLayout>
PS : 사용자 동작으로 웹보기를 이동할 가능성을 피하기 위해 BoxView
을 선언합니다.
html.Html = String.Format(@"<html><body style='background: #FF0000;'><img src='{0}' style='width:100%;height:100%;'/></body></html>", "https://media.giphy.com/media/UGifMFmx0gERG/giphy.gif");
this.Source = html;
또는 안드로이드에
this.Source = "https://media.giphy.com/media/UGifMFmx0gERG/giphy.gif";
의 this.Source = "https://media.giphy.com/media/UGifMFmx0gERG/giphy.gif";
작품은 그러나 최초의 솔루션은하지 않습니다 :
이제 점은 코드를 모두 완벽하게 UWP에서 작동한다 일하는 것이 문제입니다. 내 자신의 HTML을 만들면 gif가 링크와 달리 내보기를 채울 수 있습니다 ... 더 많은 포인트에서 html의 style='width:100%;height:100%;'
을 삭제하면 작동하지만 한 번 더 좋은 크기가 아닌 ..
아이디어가 있으십니까? 미리 감사드립니다!