Ale*_*akh 1 xamarin.ios xamarin.android xamarin xamarin.forms
我有一个Xamarin.Forms屏幕定义的核心库如下:
Content = new WebView
{
VerticalOptions = LayoutOptions.FillAndExpand,
HorizontalOptions = LayoutOptions.FillAndExpand,
Source = "https://google.com",
};
Run Code Online (Sandbox Code Playgroud)
因此,iOS的内容与系统托盘(带有系统图标的顶栏)重叠.你可以在左上角看到它们.问题是相同的托盘与Android的webview分开,我不能只添加静态上边距.我需要在"每个平台"的基础上做到这一点.有没有办法实现这一目标?
这个有可能.您可以使用该Device.OnPlatform()
方法.在API文档中了解更多信息.
用法可能是:
Device.OnPlatform (iOS: () => webView.Padding = new Thickness (0, 20, 0, 0));
Run Code Online (Sandbox Code Playgroud)
20
是状态栏的高度.
这里还有一些关于平台调整的文档.
归档时间: |
|
查看次数: |
235 次 |
最近记录: |