如何解决在Android的Xamarin.Forms.Shell应用程序中的TabBar更改后,如何防止WebView重新加载?
我正在开发一个包含4个标签的Xamarin.Forms.Shell
应用。这些标签之一包含WebView
,允许用户通过提供商提供的URL安排约会。
AppShell.xaml
看起来像这样(所有图标都用FontImageSource
设置):
<TabBar x:Name="appTabBar">
<ShellContent x:Name="tabBarHome" Title="Home" Route="HomePage" ContentTemplate="{DataTemplate local:HomePage}" />
<ShellContent Title="News" ContentTemplate="{DataTemplate local:NewsPage}" />
<ShellContent Title="Booking" Route="BookingPage" ContentTemplate="{DataTemplate local:BookingPage}" >
<ShellContent.Icon>
<FontImageSource Glyph="{StaticResource FalIconCalendar}" FontFamily="FontAwesomeLight" />
</ShellContent.Icon>
</ShellContent>
<ShellContent Title="About" Route="AboutPage" ContentTemplate="{DataTemplate local:AboutPage}" />
</TabBar>
BookingPage
看起来像这样:
<ContentPage.Content>
<Grid>
<ctrl:CustomWebView x:Name="webView"
Source="{Binding UrlBooking}"
WidthRequest="1000" HeightRequest="1000"
IsVisible="{Binding ShowWebView}">
</Grid
</ContentPage.Content>
第一次显示BookingPage
时,WebView
正在按预期加载。但是,如果用户更改选项卡并返回到BookingPage
,则有两种行为取决于平台:
- 在 iOS 上,我们保持
WebView
不变,直到更改标签为止。 - 在 Android 上,
WebView
已重新加载。
我想知道是否可以防止在Android上重新加载WebView
吗?
我已经搜索过类似How to prevent webview reload after the tab bar selection?之类的主题,但没有答案。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。