android4.4以上 webview加在图片的缩放问题
2015-09-08 14:01
537 查看
if (!data.optString("content").equals("")) { Log.d(TAG, "_______活动详情返回的图片" + data.optString("content")); TextView nameTv = new TextView(this); nameTv.setTextSize(16); nameTv.setText(data.optString("name")); WebView contentWV = new WebView(this); // contentWV.loadData(data.optString("content"), "text/html", "gb2312"); WebSettings webSettings= contentWV.getSettings(); // webView: 类WebView的实例 webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN); //就是这句 设置布局的方式 String stingpath=data.optString("content"); String head= "<head><style>img{max-width:100%;height:auto;}</style></head>"; stingpath=head+stingpath; // webSettings.setBuiltInZoomControls(true);//支持缩放 // contentWV.loadDataWithBaseURL(null, data.optString("content"), "text/html", "UTF-8", null); contentWV.loadDataWithBaseURL(null, stingpath, "text/html", "UTF-8", null); details_ll.addView(nameTv); details_ll.addView(contentWV); }
相关文章推荐
- Matrix Factorization, Algorithms, Applications, and Avaliable packages
- Android最佳性能实践(一)——合理管理内存
- 关于iOS TDD&BDD的学习与使用
- unity警告“Tiled GPU perf. warning: RenderTexture color surface (0x0) was not cleared/discarded, doin”
- Unity Application
- android——Fragment与Activity
- cocos2d-x lua c++ 相互调用代码中直接调用注册
- 2014 iOS开发者收入调查报告(一):个人开发者篇
- iOS 中国排序
- Error configuring application listener of class org.springframework.web.context.
- Android处理图片OOM的若干方法小结
- cocos3.X拖动精灵移动
- iOS开发中NSRunloop跟NSTimer的问题
- android textView 删除线的使用
- android工程添加第三方库.so文件
- 练习日的总结
- Android内存泄露案例分析(内存分析工具DDMS和MAT工具)
- 寒哥教你学 iOS - 经验漫谈(转)
- iOS提交后申请加急审核
- iOS 应用内mini文件目录浏览器