Delete CardView Overdraw

I ran the "Debug GPU Overdraw" tool in my app in attemtp to reduce the number of reinstallations. As you can see in the image below, card cards act as an extra overdraw layer. I have not yet given any additional background colors or images to my other layouts.

Is there any way to solve this problem?

enter image description here

<?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto" xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/card_view" android:layout_width="match_parent" android:layout_height="350dp" card_view:cardCornerRadius="10dp" android:layout_margin="10dp"> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent"> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:id="@+id/container_top" android:layout_width="match_parent" android:layout_height="60dp" android:background="#fff" android:layout_alignParentTop="true" android:orientation="horizontal"> <RelativeLayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1"> <ImageView android:id="@+id/thumbnail_profile" android:layout_width="50dp" android:layout_height="50dp" android:scaleType="centerCrop" android:layout_centerInParent="true"/> </RelativeLayout> <RelativeLayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="3"> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" android:layout_centerVertical="true" android:layout_marginLeft="5dp"> <TextView android:id="@+id/created_by" android:textSize="13sp" android:textStyle="bold" android:layout_width="wrap_content" android:layout_height="wrap_content"/> <TextView android:id="@+id/time_ago" android:textSize="10sp" android:layout_width="wrap_content" android:layout_height="wrap_content"/> </LinearLayout> </RelativeLayout> <RelativeLayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1"> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" android:layout_centerVertical="true" android:layout_marginLeft="5dp"> <ImageView android:id="@+id/likes_logo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_like_red"/> <TextView android:id="@+id/likes_product" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="123" android:layout_marginTop="5dp"/> </LinearLayout> </RelativeLayout> </LinearLayout> <ImageView android:id="@+id/image" android:layout_width="match_parent" android:layout_height="230dp" android:layout_centerHorizontal="true" android:layout_below="@+id/container_top" android:scaleType="centerCrop"/> <RelativeLayout android:layout_width="match_parent" android:layout_height="60dp" android:background="#fff" android:layout_alignParentBottom="true"> <TextView android:id="@+id/brand_product" android:textSize="24sp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" android:layout_marginLeft="5dp" android:layout_alignParentTop="true"/> <TextView android:id="@+id/name_product" android:textSize="18sp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" android:layout_marginLeft="5dp" android:layout_marginBottom="5dp" android:layout_alignParentBottom="true"/> </RelativeLayout> </RelativeLayout> </RelativeLayout> </android.support.v7.widget.CardView> 
+11
performance android
source share
2 answers

Both your LinearLayout and RelativeLayout have the given background #fff. Remove them and see if that helps.

0
source share

This may be a misconception, because it is not some kind of "overload", but the hardware levels are displayed greenish. If you really want to turn this off, just turn off hardware acceleration for the View (or even the whole application):

 cardView.setLayerType(View.LAYER_TYPE_SOFTWARE, null); 

I mean, you can try disabling it once to see that the green overlay has disappeared, and then delete this instruction again to enable hardware acceleration again. If it can fall behind, it probably has another reason; for example: RecyclerView in combination with ScrollView may ScrollView lag if they are not configured correctly.

0
source share

All Articles