我有这个Xamarin Forms页面:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:TestApp1"
x:Class="TestApp1.MainPage">
<ContentPage.Content>
<StackLayout Orientation="Vertical">
<WebView Source="http://www.google.de" HeightRequest="3000" WidthRequest="100"/>
</StackLayout>
</ContentPage.Content>
</ContentPage>
当我打开我的应用时,在Google提示中输入任何内容,我无法在结果页面上滚动。我该如何启用它?
当我谷歌搜索“xamarin webview enable scrolling”时,我只找到有关禁用它的信息......
答案 0 :(得分:0)
<?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="ButtonRendererDemo.WebViewPage">
<ContentPage.Content>
<StackLayout Orientation="Vertical" Padding="10" Spacing="10">
<Button Text="Press me" HorizontalOptions="CenterAndExpand" VerticalOptions="Center" BackgroundColor="Green"/>
<WebView Source="http://www.google.de" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" />
</StackLayout>
</ContentPage.Content>
</ContentPage>
答案 1 :(得分:0)
创建自己的渲染器,并按如下所示重写此方法:
public override bool DispatchTouchEvent(MotionEvent e)
{
Parent.RequestDisallowInterceptTouchEvent(true);
return base.DispatchTouchEvent(e);
}