[英]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.