webview组件出现问题(java Android)。
我创建了一个接收付款的屏幕:
public class PaymentOnLineFragment extends Fragment {
}此屏幕只有一个组件webview:
View v = inflater.inflate (R.layout.activity_pagamento, null);具有布局的xml包含以下内容:
<? Xml version = "1.0" encoding = "utf-8"?><LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android" android: orientation = "horizontal" android: layout_width = "fill_parent" android: layout_height = "fill_parent"> <WebView android: id = "@ + id / webview" android: layout_width = "fill_parent" android: layout_height = "fill_parent" />
我把我的php页面放在webview中:
webView.loadUrl("my_payment_link.php");我的问题是:
我需要每5秒更新一次我的php页面,所以我在页面的末尾添加了:
"onload="setTimeout ('delayer ()', 5000)" na tag body第一次页面在webview中正常打开,但当超过5秒为刷新时,链接将在默认的android浏览器中打开(另一个窗口打开),webview不会更新。
我想在网页被更新自己的网页视图(即在我自己的应用程序)。
有人知道怎么解决这个问题吗?
发布于 2015-05-12 05:34:40
为什么不从android代码中重新加载页面,而使用javascript呢?您可以使用线程或处理程序来执行此操作,并每隔n秒调用一次mWebView.loadUrl("http://www.websitehere.php");!
https://stackoverflow.com/questions/30177944
复制相似问题