Android 网页视图选择
我只想在设备屏幕上显示此 ,没有所有其他不必要的东西,来自此网页。到目前为止,这是我的代码...
package com.nextlogic.hellowebview;
import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;
public class HelloWebView extends Activity {
/** Called when the activity is first created. */
WebView mWebView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mWebView = (WebView) findViewById(R.id.webview);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.loadUrl("http://golfnews.no/nyheter.php?a=2013");
}
}
你能帮我吗?我们将不胜感激。谢谢。
I would like to show on the device's screen only this
, without all the other unnecessary stuff , from this web page. This is my code so far...
package com.nextlogic.hellowebview;
import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;
public class HelloWebView extends Activity {
/** Called when the activity is first created. */
WebView mWebView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mWebView = (WebView) findViewById(R.id.webview);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.loadUrl("http://golfnews.no/nyheter.php?a=2013");
}
}
Could you please help me ? It would be much appreciated. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要的是一个 HTML 解析器,例如 JSOUP。一个很棒的解析器,我将它用于很多项目。
这将允许您仅解析特定内容,
例如网页中的图像网址,然后将其检索到位图并将其设置为图像视图(最好为此使用异步任务),然后您可以使用标签来检索文本。
如果您需要这方面的帮助,请告诉我。
编辑:如何使用 jsoup 解析您的网页:
尝试一下。
编辑: 如何添加外部 jar
What you will need is a HTML Parser such as JSOUP. A great parser i use it for alot of projects.
This will allow you to parse only specific content,
Such as the image url from your webpage, and then retrieve it to a bitmap and set it to a imageview(Best to use an asynctask for this) and then you can use tags to retrieve the text.
Let me know if you need help with this.
EDIT: How to parse your Webpage with jsoup:
Try this out.
EDIT: How to add external jar's