问题
I have a layout memory issue. When I have a large webview it doesn't shows anything and the logcat shows "View too large to fit into drawing cache".
The layout is:
<ScrollView
android:id="@+id/scrollNoticia"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/ficha_curva"
android:layout_below="@+id/linea"
android:scrollbars="none"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="12dp"
>
<WebView
android:id="@+id/webViewNoticia"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none"
/>
<GridView
android:id="@+id/gridGaleria"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/webViewNoticia"
android:horizontalSpacing="4dp"
android:verticalSpacing="4dp"
android:numColumns="4" >
</GridView>
</RelativeLayout>
</ScrollView>
回答1:
Neither WebView or GridView need to be embedded in a scrollview. The WebView can scroll by itself when the content size over the screen size, and the GridView too. In the normal way, the GridView just create so many child views as are visible. Once a view goes out of screen, it will be reused. So if you embed a GridView in a ScrollView, maybe you will wrong the reuse pattern.
回答2:
Try disabling the hardware acceleration : http://developer.android.com/guide/topics/graphics/hardware-accel.html
See WebView in ScrollView: "View too large to fit into drawing cache" - how to rework layout? for more informations.
来源:https://stackoverflow.com/questions/15790317/webview-and-gridview-into-scrollview-view-too-large-to-fit-into-drawing-cache