WebViews对Android的谷歌阅读器式的优化 [英] Google Reader-esque optimizing of WebViews on Android

查看:153
本文介绍了WebViews对Android的谷歌阅读器式的优化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序显示在一个web视图一篇博客文章的HTML。但图像,都相当大,不适合在屏幕上。当观看帖子在Android谷歌阅读器应用程序,但是,所有的图像都有其宽度减小到适合屏幕。

I have an app that displays the html of a blog post in a WebView. The images, however, are rather large and do not fit to the screen. When viewing the post in the Android Google Reader app, however, all of the images have their width reduced to fit the screen.

Android的谷歌阅读器也将分析出所有嵌入YouTube和Vimeo的嵌入,并与缩略图的链接替换这样的专用YouTube播放器可以播放视频,而不是。

The Android Google Reader will also parse out all embedded Youtube and Vimeo embeds and replace them with thumbnails with links so the dedicated Youtube player can play the video instead.

我怎么会去这样做呢?我已经使用Jsoup来匹配后的所有图像,并改变它们的宽度试过,但我不知道如何去修改的YouTube视频嵌入。

How would I go about doing this? I've tried using Jsoup to match all the images in a post and alter their width, but I don't know how to go about modifying the Youtube video embeds.

推荐答案

有关转换嵌入YouTube视频缩略图,你可以用mobitube.js code从的 Mobilize.js项目

For converting embed Youtube videos to thumbnails you can do it with mobitube.js code from Mobilize.js project:

https://github.com/mobilizejs/mobilize。 JS / BLOB /主/ JS / mobitube.js

此外,我认为,谷歌阅读器只需使用CSS覆盖调整大小的图像。

Also I believe Google Reader simply resizes the images using CSS overrides.

Mobilize.js也有工具来重写图像标记,并执行去浮的操作对他们来说:

Mobilize.js has also tools for rewriting image tags and perform "de-float" operation for them:

https://github.com/mobilizejs/ mobilize.js / BLOB /主/ JS / mobilize.js#L2005

更多关于defloat算法中:

More about defloat algo:

http://webandmobile.mfabrik.com/docs/网络和移动/用户手册/调整

如果你想调整在服务器端的图像,这是一个第三方的解决方案:

If you want to resize images on the server-side this is a third party solution:

http://adaptive-images.com/

...虽然从从头开始编写自己的图像大小调整代理服务器是不是具有挑战性。

... though writing your own image resize proxy server from the scratch is not that challenging.

这篇关于WebViews对Android的谷歌阅读器式的优化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆