【发布时间】:2019-01-11 07:12:06
【问题描述】:
当我使用 webview 时,它的顶部和底部有间隙,或者如果水平放置,它的侧面有间隙。如何让 webview 填满整个屏幕。
您可以在屏幕截图中看到蓝色区域是内容的背景颜色。为什么 webview 不从顶部开始?
我还在屏幕顶部添加了一个正确分层的标签。
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="WorkingWithWebview.MyPage" >
<ContentPage.Content>
<StackLayout VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
<Label Text="this is a label showing its not the nav bar" BackgroundColor="Red"></Label>
<WebView VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"
Source="https://www.google.com" WidthRequest="1000" HeightRequest="1000">
</WebView>
</StackLayout>
</ContentPage.Content>
</ContentPage>
【问题讨论】:
-
您使用的是哪个版本的 Xamarin.Forms?你还在为布局做其他事情吗?我没有看到这种行为
-
试试这个:选项1:设置
VerticalOptions="StartAndExpand"的WebView或选项2:如果您的主页可能是导航栏空间,则将导航栏的可见性设置为false。 -
尝试了所有这些,但没有任何区别
标签: android ios webview xamarin.forms