WebView and GridView into ScrollView, View too large to fit into drawing cache
Asked Answered
S

2

6

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>
Sciamachy answered 3/4, 2013 at 14:34 Comment(2)
Did u get any solution for this??Makkah
Yes I got a solution which is more of a workaround, i calculate the webview height and if it is greater than a particular height i just change the height of webview to that particular height. I am using this in my current app and it works fineMakkah
Z
0

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.

Zygotene answered 17/12, 2013 at 15:38 Comment(1)
This is not helpful. He (and I) needs it in a scroll view from various reasons.Brachio

© 2022 - 2024 — McMap. All rights reserved.