Ale*_*akh 5 webview xamarin.ios xamarin xamarin.forms
我在核心库中定义了网页作为填充整个屏幕的视图:
Content = new WebView
{
VerticalOptions = LayoutOptions.FillAndExpand,
HorizontalOptions = LayoutOptions.FillAndExpand,
Source = "https://google.com",
};
Run Code Online (Sandbox Code Playgroud)
不幸的是在屏幕上旋转它没有调整大小(请参见下文):
如何确保在屏幕旋转时调整屏幕大小.
如果是iOS,则制作自定义WebView渲染器(http://developer.xamarin.com/guides/cross-platform/xamarin-forms/custom-renderer/):
protected override void OnElementChanged (VisualElementChangedEventArgs e)
{
base.OnElementChanged(e);
AutoresizingMask = UIViewAutoresizing.FlexibleDimensions;
ScalesPageToFit = true;
}
public override void LayoutSubviews()
{
base.LayoutSubviews();
NativeView.Bounds = UIKit.UIScreen.MainScreen.Bounds;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2885 次 |
| 最近记录: |