简体   繁体   中英

Load webview with large content in a scrollview in android

I am trying to add a WebView and some other TextView s in a ScrollView . It works fine till the content size is small. But when the content increases (which is to be loaded in WebView ), it throws an error saying:

View too large to fit into drawing cache, needs 'x' bytes, only 'y' available".

I tried all different flags and all answers on StackOverflow which I could find, but still unable to solve the issue. Is there a way to have a WebView inside ScrollView or not?

I can't use hardwareAccelerated flag, it makes the whole Activity slow.

为了使它工作,我设置ScrollViewWebView属性:

android:layerType="software"

Make the WebView Height and Width as wrap_content . And Use ScrollView For whole layout page so that your TextView s can be visible.

您可以在XML中使用wrap_contentfill_parent作为宽度和高度。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM