webview可以获取网页源码,进行重新排版吗
来源:互联网 发布:php 序列化 编辑:程序博客网 时间:2024/06/05 19:41
private void getHtml_data(String Url, int FontSize) {
String text = "";
try {
URL url = new URL(Url);
URLConnection conn;
conn = url.openConnection();
// Get the response
BufferedReader rd = new BufferedReader(new InputStreamReader(conn
.getInputStream()));
String line = "";
String data = "";
while ((line = rd.readLine()) != null) {
Message lmsg;
lmsg = new Message();
lmsg.obj = line;
lmsg.what = 0;
data = data + (String) lmsg.obj;
}
text = data.replace("<body>", "<body style=\"font-size:" + FontSize
+ "px;\">");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
myWebView.loadDataWithBaseURL("", text, "text/html", "UTF-8", null);
}
data就是你要的网页源码,text修改(就像我在body 加上size)
最后用myWebView.loadDataWithBaseURL("", text, "text/html", "UTF-8", null);
String text = "";
try {
URL url = new URL(Url);
URLConnection conn;
conn = url.openConnection();
// Get the response
BufferedReader rd = new BufferedReader(new InputStreamReader(conn
.getInputStream()));
String line = "";
String data = "";
while ((line = rd.readLine()) != null) {
Message lmsg;
lmsg = new Message();
lmsg.obj = line;
lmsg.what = 0;
data = data + (String) lmsg.obj;
}
text = data.replace("<body>", "<body style=\"font-size:" + FontSize
+ "px;\">");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
myWebView.loadDataWithBaseURL("", text, "text/html", "UTF-8", null);
}
data就是你要的网页源码,text修改(就像我在body 加上size)
最后用myWebView.loadDataWithBaseURL("", text, "text/html", "UTF-8", null);
- webview可以获取网页源码,进行重新排版吗
- Android:在WebView中获取网页源码
- Android:在WebView中获取网页源码
- Android: 在WebView中获取网页源码
- 在webview中获取网页源码
- Android: 在WebView中获取网页源码
- Android: 在WebView中获取网页源码
- Android: 在WebView中获取网页源码
- Android: 在WebView中获取网页源码
- Android: 在WebView中获取网页源码
- Android: 在WebView中获取网页源码
- Android: 在WebView中获取网页源码
- Android 在WebView中获取网页源码
- Android: 在WebView中获取网页源码
- Android: 在WebView中获取网页源码
- 获取WebView加载的网页内容并进行动态修改
- android系列: 在WebView中获取网页源码
- webview获取网页cookie
- http://acm.hdu.edu.cn/showproblem.php?pid=1106&&排序
- 如何实现类的成员函数作为回调函数
- VS2003下载地址
- Ubuntu 修改myeclipse背景色
- 指针
- webview可以获取网页源码,进行重新排版吗
- RegistryBooster 2012 and SpeedUpMyPC 2012
- 申请和释放堆内存
- ubuntu11.10 下编译 opencv2.4 所遇到的问题总结
- 提高jQuery性能
- 综合实例:PIC单片机(PIC16F877A)万年历(温度闹钟年月日时分秒星期)
- MyEclipse下创建Maven Web Project
- php设计模式学习
- 命令行参数