Ответ 1
И ваш LinearLayout
и RelativeLayout
имеют заданный фон #fff. Удалите их и посмотрите, поможет ли это.
Я запустил инструмент "Debug GPU Overdraw" в своем приложении в attemtp, чтобы уменьшить количество переустановленных. Как видно на изображении ниже, кард-карты действуют как дополнительный слой overdraw. Я еще не дал никаких дополнительных цветов фона или изображений другим моим макетам.
Есть ли способ решить эту проблему?
<?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>
И ваш LinearLayout
и RelativeLayout
имеют заданный фон #fff. Удалите их и посмотрите, поможет ли это.
Это может быть неправильным представлением, потому что это не какая-то "перегрузка", а аппаратные уровни отображаются зеленоватыми. Если вы действительно хотите отключить это, просто отключите аппаратное ускорение для View
(или даже всего приложения в целом):
cardView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
Я имею в виду, что вы можете попробовать отключить его один раз, чтобы увидеть, что зеленоватое наложение исчезло, а затем снова удалить эту инструкцию, чтобы снова включить аппаратное ускорение. Если это может отставать, у этого, вероятно, есть другая причина; например: RecyclerView
в сочетании с ScrollView
может ScrollView
запаздывать, если они неправильно настроены.