Android的奇巧的WebView CSS定位 [英] Android kitkat webview css positioning

查看:304
本文介绍了Android的奇巧的WebView CSS定位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用的WebView的Andr​​oid应用程序。我在我的应用程序3个元素,我使用CSS来定位他们在屏幕的顶部。我用百分比的宽度,高度和位置。 html文件工作在桌面和移动Chrome浏览器完美的罚款。但是,当我尝试在WebView中的位置是不正确的,似乎在CSS有一些错误。当我试图在Android 4.2的应用程序,但发生在Android 4.4系统不会出现此问题。

我知道有在Android 4.4的网页视图一些变化,但迁移的文件没有帮助。

下面是显示了我的HTML和CSS cssdesk的链接: href=\"http://www.cssdesk.com/Z98q3\" rel=\"nofollow\"> http://www.cssdesk.com/Z98q3
我将AP preciate如果你能帮助我与此有关。
非常感谢

I have an android app which uses webview. I have 3 elements in my app and I use css to position them on top of the screen. I use percentages for their width,height and positions. the html file works perfectly fine in desktop and mobile chrome browser. But when I try it in webview the positions are not correct and seems the css has something wrong. this problem doesn't occur when I tried the app on android 4.2 but happens on android 4.4.
I know there are some changes in Webview of android 4.4 but migration document didn't help.
Here's a link of cssdesk that shows my html and css :
http://www.cssdesk.com/Z98q3
I'll appreciate if you can help me with this.
Thanks very much

推荐答案

我不知道你是否已经尝试过这一点,但尝试把这个在你的脑袋:

I don't know if you've already tried this, but try putting this in your head:

<meta name="viewport" content="width=device-width; user-scalable=no; initial-scale=1.0; minimum-scale=1.0; maximum-scale=1.0; target-densityDpi=device-dpi;">

您可能需要restyle你的按钮了一下,因为这有时会中断按钮Android的渲染,只是设置背景颜色应该解决这个问题。

You might have to restyle your buttons a bit, because this breaks android's rendering of buttons sometimes, but just setting a background colour should fix that.

这篇关于Android的奇巧的WebView CSS定位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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