Reputation: 108
I have a RecyclerView that has 4 items, and clipToPadding
set to false
I have set 50dp for both margins, and the margin is enforced correctly for the backgroundColor, but the items of the RecyclerView are going out of the RecyclerView bounds.
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:background="#0F0"
android:layout_marginStart="50dp"
android:layout_marginEnd="50dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent">
</android.support.v7.widget.RecyclerView>
here is an image to demonstration .
The black background is the parent ConstraintLayout, and the green background is the color set to the recyclerView, the white / blue items are the ViewHolders.
I have a custom LayoutManager in this image, but the bug occures with the default LinearLayoutManager as well.
Any idea what can be the cause?
Upvotes: 3
Views: 1462
Reputation: 1171
This bug happens when you have clipChildren
in your parent layout set to true
.
delete the line and it should resolve your bug.
Upvotes: 6