I am using RecyclerView with GridLayoutManager and I have each item as CardView.
Unfortunately, the CardView here does not seem to change its background color. I tried in layout and programmatically as well but I have tried nothing seems to work.
I Have been struggling for quite a while. I appreciate if someone could help me out with this issue.
If you want to change the card background color, use:
app:cardBackgroundColor="@somecolor"
like this:
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardBackgroundColor="@color/white">
</android.support.v7.widget.CardView>
Edit: As pointed by @imposible, you need to include
xmlns:app="http://schemas.android.com/apk/res-auto"
in your root XML tag in order to make this snippet function