Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在安卓app中viewport无效 #29

Closed
KevisLuo opened this issue Nov 2, 2016 · 5 comments
Closed

在安卓app中viewport无效 #29

KevisLuo opened this issue Nov 2, 2016 · 5 comments

Comments

@KevisLuo
Copy link

KevisLuo commented Nov 2, 2016

我们公司的安卓app内置的webview当中viewport好像并没有生效,1px的线还是那么粗!尝试做了 settings.getUserAgentString();
//增加下面两行代码:
settings.setUseWideViewPort(true);
settings.setLoadWithOverviewMode(true);
但还是没有效果,请问是需要其他的什么配置吗?

@imochen
Copy link
Owner

imochen commented Nov 3, 2016

  • 1、确认下hotcss有没有强制dpr=1
<meta name="hotcss" content="initial-dpr=1">
  • 2、尝试在原生浏览器打开,验证是否正常显示。

@KevisLuo
Copy link
Author

KevisLuo commented Nov 3, 2016

  1. 并没有设置强制dpr=1
    2.在原生浏览器的和ios设备的都是正常的
    所以我觉得是不是要在app做什么配置,咨询了我们的安卓开发,他们也是不清楚,只能来这里求助了-_-

@imochen
Copy link
Owner

imochen commented Nov 3, 2016

让安卓开发打开debug开关,然后PC Chrome远程调试一下页面。定位一下问题。
可能出现问题的地方:dprdocument.documentElement.getBoundingClientRect().width

安卓webview开启debug方法如下:
调试WebView需要满足安卓系统版本为Android 4.4+。在WebView类中调用静态方法setWebContentsDebuggingEnabled

if (Build.VERSION.SDK_INT >=Build.VERSION_CODES.KITKAT) {  
    WebView.setWebContentsDebuggingEnabled(true);  
}

@KevisLuo
Copy link
Author

KevisLuo commented Nov 3, 2016

之前debug过,dpr和meta设置都是对的,只是scale的效果并没有生效

@imochen
Copy link
Owner

imochen commented Nov 8, 2016

这个问题配合安卓开发debug下吧。纯前端已然看不出任何问题了。先close掉。任何疑问随时联系。

@imochen imochen closed this as completed Nov 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants