我正在ScrollView中使用WebView
,并且它在Samsung SM-J610F上给出了IllegalStateException
。在我测试过此代码的其他设备上,它运行正常。
当我从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
......
答案 0 :(得分:0)
将Web视图从滚动视图中移出并单独放置。同样,所有其他现有视图也将它们添加到Scrollview内。这样,您的网络视图也将保持稳定,用户将能够滚动并引用其他视图。 另外,应该正确声明和实施webview:
java.lang.ClassCastException: class java.util.HashMap cannot be cast to class com.engynya.mongo.model.CustomData (java.util.HashMap is in module java.base of loader 'bootstrap'; com.engynya.mongo.model.CustomData is in unnamed module of loader 'app')
根据上面的代码,所有视图都在web视图的上方,并且webview使用方法覆盖了其余屏幕尺寸的其余部分
.setInitialScale(1);
如有需要,请进行投票!