gpt4 book ai didi

c# - CustomWebViewRenderer DownloadManager 与 CopyBackForwardList 的问题

转载 作者:行者123 更新时间:2023-12-02 02:34:26 25 4
gpt4 key购买 nike

我仍在学习 android,我正在使用此 recommendation 创建一个混合应用程序。一切正常,但是当我下载完文件后我无法返回,我正在尝试使用 copyBackForwardList 方法,但我不确定如何将 Xamarin.Forms.WebView 转换为 Android.Webkit.WebView 以使用 CopyBackForwardList 并使用其他 recommendation

我正在尝试这样的事情

    protected override bool OnBackButtonPressed()
{
base.OnBackButtonPressed();

String historyUrl = "";
int i = 0;
WebBackForwardList mWebBackForwardList = (Android.Webkit.WebView)browser;
if (mWebBackForwardList.getCurrentIndex() > 0)
{
while (i < mWebBackForwardList.getCurrentIndex())
{
historyUrl = mWebBackForwardList.getItemAtIndex(mWebBackForwardList.getCurrentIndex() - ++i).getUrl();
if (historyUrl != null)
{
browser.Source = historyUrl;
Content = browser;
}
}
}


return true;
}

最佳答案

如果您想访问 native 控件,可以通过自定义渲染器来完成 https://learn.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/custom-renderer/

关于c# - CustomWebViewRenderer DownloadManager 与 CopyBackForwardList 的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59107967/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com