Android webview 的替代方案

发布于 2024-12-07 13:25:35 字数 322 浏览 1 评论 0原文

有谁知道 Android 的 webview 组件的替代品吗?由于某些原因,它的功能对我来说是不够的:当我浏览 wml 页面(wap)时,我需要能够捕获对某个 url 的每个请求。不管怎样,我需要能够做 Android 的 webview 不适合做的事情。 我想“嘿,让我们玩一下源代码,我很确定 webviews 正在使用 apache.org 库来访问互联网”。 天哪,我错了。 Webviews 使用本机代码,这就是我陷入困境的地方。

所以我想知道是否有人知道另一种纯 java 的网络浏览器视图,它是开源的并且很好。如果速度慢也不是问题,我正在显示一些基本的 wap 页面...

提前致谢。

Does anyone knows an alternative to Android's webview component ? For some reasons, it's functionality's are insufficient for me : I need to be able to catch every single request to some url, when i'm browsing a wml page (wap). Anyway, I need to be able to do stuff that Android's webview is not made for.
I thought "hey, let's play with the source code, I'm pretty sure that webviews are using apache.org librairies to access internet".
Oh boy was I mistaken. Webviews use native code, and that's where I'm stuck.

So I was wondering if anyone knew of another web browser view, in pure java, that would be open source and nice. It's not a problem if it's slow, i'm displaying some basic wap pages...

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

∞琼窗梦回ˉ 2024-12-14 13:25:35

您可以使用 setWebViewClient & 来扩展 WebView 的功能。 setWebChromeClient。

WebView.setWebViewClient(new MyWebViewClient());
WebView.setWebChromeClient(new WebChromeClient() {..}

您可以通过重写以下方法来处理从 WebView 发送/接收的每个请求:

public boolean shouldOverrideUrlLoading(WebView view, String url) {..}
public void onPageStarted(WebView view, String url, Bitmap favicon) {..}
public void onPageFinished(WebView view, String url) {..}

You can extend WebView's functionality by using setWebViewClient & setWebChromeClient.

WebView.setWebViewClient(new MyWebViewClient());
WebView.setWebChromeClient(new WebChromeClient() {..}

You can handle each and every request sent/received from the WebView by overriding the below methods:

public boolean shouldOverrideUrlLoading(WebView view, String url) {..}
public void onPageStarted(WebView view, String url, Bitmap favicon) {..}
public void onPageFinished(WebView view, String url) {..}
2024-12-14 13:25:35

人行横道项目:https://crosswalk-project.org/ 可能就是您所需要的。但请注意,它与 Stock webview 存在一些不同的地方。在某些方面更好,在某些方面更糟。例如,它支持WebGL(好),但目前背景不能透明(坏)。真正的好消息是,它似乎得到了非常积极的支持,运行自己的 Jira 来跟踪和修复,而且英特尔似乎也非常参与其中。

The crosswalk project: https://crosswalk-project.org/ might be what you need. But beware, there are places where it differs from the stock webview. In some ways better, in some ways worse. For example, it supports WebGL (good), but currently the background cannot be transparent (bad). The really good news, it seems to be very actively supported, running it's own Jira to track and fix and Intel seems to be very involved.

夜夜流光相皎洁 2024-12-14 13:25:35

尝试看看 Opera Mini 是如何编程的。

但我认为如果你想要另一个,你必须对其进行编程。但如果它有很好的表现,我会感到惊讶。

Try to see how was Opera Mini programmed.

But I think you must program it if you want another one . But i would be surprised if it has a nice performance.

猫九 2024-12-14 13:25:35
       Try this: 

      goButton4.setOnClickListener(new OnClickListener() {
           public void onClick(View view) {               
               Uri uri = Uri.parse("http://tory.com/");
               Intent intent = new Intent(Intent.ACTION_VIEW, uri);
               startActivity(intent);                  
        }
    });
       Try this: 

      goButton4.setOnClickListener(new OnClickListener() {
           public void onClick(View view) {               
               Uri uri = Uri.parse("http://tory.com/");
               Intent intent = new Intent(Intent.ACTION_VIEW, uri);
               startActivity(intent);                  
        }
    });
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文