android - 如何在 Android 上的 Xamarin.Forms.Shell 应用程序中的 TabBar 更改后防止 WebView 重新加载?
问题描述
我在一个Xamarin.Forms.Shell
包含 4 个标签的应用程序上工作。其中一个选项卡包含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
则取决于平台有 2 种行为:
- 在iOS上,我们保持
WebView
原样以更改选项卡。 - 在Android上,
WebView
会重新加载。
我想知道是否有办法防止WebView
在 Android 上重新加载?
我已经搜索过类似的主题,例如如何在标签栏选择后防止 webview 重新加载?但没有答案。
解决方案
推荐阅读
- python - Kosaraju 的 scc 算法
- ios - Facebook 快速登录
- javascript - 如何在反应+材料中为表格单元格提供全宽?
- c - 如果 char[] 在结构 __attribute__((aligned)) 中,char[] 的步幅是否保证为 1?
- algorithm - 使列表中每个位置的硬币数量相等所需的最小硬币移动次数
- javascript - 是否可以获得附加伪元素的元素的innerHTML?
- php - Wordpress 超级管理员登录问题。(自动注销)
- java - 我应该使用什么命令从使用 Windows 注册表的上下文菜单中启动 jar 文件?
- c++ - 如何从仅使用空格作为分隔符的文件中获取要写入的二维数组
- javascript - Framework7 和 Material Design:样式未渲染