Использую CardView в recycleView. По длинному нажатию включаю ActionMode и изменяю цвет cardView следующим образом:
((CardView)holder.itemView).setCardBackgroundColor()
Происходит следующая непонятная вещь. Фон меняется, но каким то образом остаётся ещё какой-то задний фон. Причём, если задаю значение фона из разметки всё нормально.
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/cardView"
card_view:cardCornerRadius="20dp"
card_view:contentPadding="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/itemTitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="5"
android:gravity="center_vertical|start"
android:text="Title"
android:textColor="@android:color/black"
android:textSize="14sp" />
<CheckBox
android:id="@+id/checkBox"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:clickable="false"
android:focusable="false"/>
</LinearLayout>