ernestoyaquello/DragDropSwipeRecyclerview

Swipe background color corner radius

amatkivskiy opened this issue ยท 2 comments

Hi @ernestoyaquello
First of all thanks a lot for this wonderful library ๐Ÿ‘

I've just started using it so I might miss something but I am using MaterialCardView for the list item layout - swipe background comes without corner radius on it ๐Ÿ˜ž

It can be easily demonstrated in your sample app if you set the corner radius to 20dp (in list_item_vertical_list_cardview.xml) for example.
I've made a quick demo video on this:

ezgif com-video-to-gif

In my code, I need to set the corner radius to 0dp to avoid such an issue ๐Ÿ˜ž
Can you please help with this?

There are two ways to set a background that will appear when you swipe an item:

  1. You define a colour and an icon and let the library draw the background for you as a rectangle (for this, you need to set properties such as behindSwipedItemBackgroundColor, behindSwipedItemIconDrawableId, behindSwipedItemIconMargin, etc).
  2. You define a custom layout that will be used as the background (by setting properties such as behindSwipedItemLayoutId and behindSwipedItemSecondaryLayoutId).

When using a CardView, just use a custom layout with whatever corner radius you want. Take a look at the layout behind_swiped_grid_list.xml of the sample project if you want a reference.

I hope that helps!

Thanks @ernestoyaquello I will try later ๐Ÿ‘