mug*_*198 6 java android webview samsung-mobile
我WebView在ScrollView中使用,并且IllegalStateException在Samsung SM-J610F上使用。在我测试过此代码的其他设备上,它运行正常。
当我取出来WebView时ScrollView效果很好。但是问题在于,我在WebView下面还有其他视图,如果不使用ScrollView,则用户将无法看到这些视图。
Font Cache (CPU):
Size: 103.02 kB
Glyph Count: 37
CPU Caches:
Shadows: 4.22 KB (2 entries)
GPU Caches:
Other:
Buffer Object: 63.00 KB (2 entries)
Image:
Texture: 1.81 MB (28 entries)
Texture( 1): 168840 Byte (count:8)
Texture( 2): 54288 Byte (count:1)
Texture( 3): 44100 Byte (count:1)
Texture( 4): 31684 Byte (count:6)
Texture( 5): 29580 Byte (count:1)
Texture( 6): 29568 Byte (count:1)
Texture( 7): 29232 Byte (count:3)
Texture( 8): 28896 Byte (count:1)
Texture( 9): 28560 Byte (count:1)
Texture(10): 11024 Byte (count:1)
.......
Scratch:
Texture: 512.00 KB (1 entry)
RenderTarget: 1.46 MB (14 entries)
Buffer Object: 96.03 KB (4 entries)
Other Caches:
Current / Maximum
VectorDrawableAtlas 0.00 kB / 0.00 KB (entries = 0)
Layers Total 0.00 KB (numLayers = 0)
Total GPU memory usage
JNI DETECTED ERROR IN APPLICATION: JNI CallObjectMethod called with pending exception java.lang.IllegalStateException: Unable to create layer for WebView, size 640x7040 max size 8192 color type 4 has context 1
......
Run Code Online (Sandbox Code Playgroud)
将 webview 从滚动视图中移除并单独放置。此外,所有其他视图都将它们添加到滚动视图中。这样你的 webview 也会稳定,用户将能够滚动并引用其他视图。另外,webview 应该正确声明和实现:
wv = (WebView) findViewById(R.id.web_view);
wv.setInitialScale(1); //webview page matches the screen size.
wv.getSettings().setLoadWithOverviewMode(true);
wv.getSettings().setUseWideViewPort(true);
wv.getSettings().setJavaScriptEnabled(true);
wv.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT); //loads online website when no internet connection.
wv.loadUrl("https://prajwalwaingankar.wixsite.com/nivala");
Run Code Online (Sandbox Code Playgroud)
根据上面的代码,所有视图都位于 Web 视图之上,并且 Web 视图使用方法
.setInitialScale(1); 覆盖剩余屏幕尺寸的其余部分;
| 归档时间: |
|
| 查看次数: |
332 次 |
| 最近记录: |