的WebView和GridView成滚动型,查看过大,以适应绘图缓存过大、缓存、以适应、WebView

2023-09-07 17:24:03 作者:你是人间最后一抹解药

我有一个布局内存问题。当我有一个大的WebView它不显示任何东西和logcat的显示查看过大,以适应绘图缓存。

的布局是:

 <滚动型    机器人:ID =@ + ID / scrollNoticia    机器人:layout_width =match_parent    机器人:layout_height =match_parent    机器人:背景=@绘制/ ficha_curva    机器人:layout_below =@ + ID / LINEA    机器人:滚动条=无    >    < RelativeLayout的        机器人:layout_width =match_parent        机器人:layout_height =WRAP_CONTENT        机器人:paddingBottom会=12dp         >        <的WebView            机器人:ID =@ + ID / webViewNoticia            机器人:layout_width =match_parent            机器人:layout_height =WRAP_CONTENT            机器人:滚动条=无             />        < GridView控件            机器人:ID =@ + ID / gridGaleria            机器人:layout_width =match_parent            机器人:layout_height =WRAP_CONTENT            机器人:layout_below =@ ID / webViewNoticia            机器人:horizo​​ntalSpacing =4DP            机器人:verticalSpacing =4DP            机器人:为numColumns =4>        < / GridView的>    < / RelativeLayout的>< /滚动型> 

解决方案

尝试禁用硬件加速:的 http://developer.android.com/guide/topics/graphics/hardware-accel.html

请参阅WebView在滚动型:"查看过大,以适应绘图缓存" - ?如何返工布局获取更多的信息。

GRIDVIEW内容详解

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>

解决方案

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.