Android的奇巧的WebView CSS定位奇巧、Android、CSS、WebView

由网友(我特么限量版的﹌)分享简介:我有一个使用的WebView的Andr​​oid应用程序。我在我的应用程序3个元素,我使用CSS来定位他们在屏幕的顶部。我用百分比的宽度,高度和位置。 html文件工作在桌面和移动Chrome浏览器完美的罚款。但是,当我尝试在WebView中的位置是不正确的,似乎在CSS有一些错误。当我试图在Android 4.2的应...

我有一个使用的WebView的Andr​​oid应用程序。我在我的应用程序3个元素,我使用CSS来定位他们在屏幕的顶部。我用百分比的宽度,高度和位置。 html文件工作在桌面和移动Chrome浏览器完美的罚款。但是,当我尝试在WebView中的位置是不正确的,似乎在CSS有一些错误。当我试图在Android 4.2的应用程序,但发生在Android 4.4系统不会出现此问题。我知道有在Android 4.4的网页视图一些变化,但迁移的文件没有帮助。 下面是显示了我的HTML和CSS cssdesk的链接: 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.

阅读全文

相关推荐

最新文章