BomberBus
BomberBus

Reputation: 1235

RecyclerView Divider Space

I create a list with a simple RecyclerView and CardView without any style properties.

<android.support.v7.widget.RecyclerView
        android:id="@+id/shops_list"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

And I get the expected result when I run in android 4.2.2 device like the following screenshot.

Screenshot in android 4.2.2 Genymotion emulator

But, when I run in Android version 6.0.1, there is no space between CardView item like the following.

Screenshot in android 6.0.1 real device

I would like to get some space between CardView item like the above screenshot. Is need to add space or divider height manually? Please help :-)

Upvotes: 0

Views: 885

Answers (1)

Arth Tilva
Arth Tilva

Reputation: 2496

Use app:cardUseCompatPadding="true"in CardView.

CardView adds padding in platforms pre-L to draw shadows. In L, unless you set useCompatPadding=true, there should not be any gap.

Upvotes: 4

Related Questions