[英]What does "this" refer to in Android checkSelfPermission()?
[英]Android: What does this warning message refer to? - (WebCore)
我有一个包含WebView作为其子项的Gallery,当我滚动Gallery时,我收到以下警告,
'04-07 19:35:37.409: WARN/webcore(664): Can't get the viewWidth after the first layout
04-07 19:35:37.470: WARN/webcore(664): skip viewSizeChanged as w is 0'
这个警告是指什么? [我没有硬编码任何布局参数。]
任何关于为什么发生此警告的指示都会非常有用......
这些也被打印出来了
04-15 11:10:13.202: DEBUG/webviewglue(617): nativeDestroy view: 0x257f40
04-15 11:10:13.243: DEBUG/webviewglue(617): nativeDestroy view: 0x25d680
04-15 11:10:13.292: DEBUG/webviewglue(617): nativeDestroy view: 0x240688
04-15 11:10:13.332: DEBUG/webviewglue(617): nativeDestroy view: 0x249918
04-15 11:10:13.373: DEBUG/webviewglue(617): nativeDestroy view: 0x226608
04-15 11:10:13.423: DEBUG/webviewglue(617): nativeDestroy view: 0x21e418
04-15 11:10:13.482: DEBUG/webviewglue(617): nativeDestroy view: 0x23a4e8
04-15 11:10:13.533: DEBUG/webviewglue(617): nativeDestroy view: 0x235c68
04-15 11:10:13.572: DEBUG/webviewglue(617): nativeDestroy view: 0x212a28
提前致谢。
您的viewSize已更改并正在通知此情况,由于某种原因宽度值为0(可能会缩放)。 如下所示:
// notify webkit that our virtual view size changed size (after inv-zoom)
private void viewSizeChanged(int w, int h, int textwrapWidth,
float scale, int anchorX, int anchorY, boolean ignoreHeight) {
if (DebugFlags.WEB_VIEW_CORE) {
Log.v(LOGTAG, "viewSizeChanged w=" + w + "; h=" + h
+ "; textwrapWidth=" + textwrapWidth + "; scale="
+ scale);
}
if (w == 0) {
Log.w(LOGTAG, "skip viewSizeChanged as w is 0");
return;
}
int width = w;
if (mSettings.getUseWideViewPort()) {
if (mViewportWidth == -1) {
if (mSettings.getLayoutAlgorithm() == WebSettings.LayoutAlgorithm.NORMAL) {
width = WebView.DEFAULT_VIEWPORT_WIDTH;
} else {
/*
* if a page's minimum preferred width is wider than the
* given "w", use it instead to get better layout result. If
* we start a page with MAX_ZOOM_WIDTH, "w" will be always
* wider. If we start a page with screen width, due to the
* delay between {@link #didFirstLayout} and
* {@link #viewSizeChanged},
* {@link #nativeGetContentMinPrefWidth} will return a more
* accurate value than initial 0 to result a better layout.
* In the worse case, the native width will be adjusted when
* next zoom or screen orientation change happens.
*/
width = Math.min(WebView.sMaxViewportWidth, Math
.max(w, Math.max(
WebView.DEFAULT_VIEWPORT_WIDTH,
nativeGetContentMinPrefWidth())));
}
} else if (mViewportWidth > 0) {
width = Math.max(w, mViewportWidth);
} else {
width = textwrapWidth;
}
}
我在此处使用的文档可以在此处获取更多信息。 没有看到你的代码,我不确定为什么会发生这种情况。 然后它显然只是使用这些参数跳过任何视图的调整,因此你有你的日志。
[编辑]除了能够显示代码(可理解)之外我唯一可以真正引用的东西,除了我之前所说的是我刚才在这里读过的讨论,它揭示了不同的上下文包含不同数据的事实。 您可能能够使用活动上下文而不是引擎或应用程序上下文..没有多大帮助,但可能是第一个金砖。 : - ? 祝你好运,希望你能管理,我会留意你的任何参考资料。
我遇到了同样的问题,我的普通webview无法正常工作,并且给了我与你所描述的相同的错误。
skip viewSizeChanged as w is 0
据我所知,这与Android缩放有关,新设备允许这样做以避免应用程序(专为手机设计)在平板电脑上显示为小窗口应用程序。
我的解决方案
WebView mWebView = (WebView) findViewById(R.id.webview);
mWebView.getSettings().setBuiltInZoomControls(true);
最后一行setBuiltInZoomControls(true)让我的问题消失了。 我希望这可以帮助你!
[编辑]这个解决方案昨天对我很好,但是今天早上我又得到了错误。 这可能不是解决方案。 很抱歉有误导性的帖子。
[编辑2]现在我已经更改了我的代码,之后我没有再次遇到错误,我运行了1000次迭代的测试套件而没有错误。 解决了我的问题的原因是url没有正确传递给webview。 它确定了一个正确的url问题消失后得到一个空字符串。 希望这会对某人有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.