Tunous / SwipeActionView

Android swipe-able view, which allows users to perform actions with swipe gestures.
Apache License 2.0
198 stars 17 forks source link

How to set only the right background view in XML for left swipe gesture. #31

Closed AkankshaRana closed 2 years ago

AkankshaRana commented 2 years ago

Hi, I just want to allow the user to only swipe left and hence just want to add the right background view. Right now if I add one view in SwipeActionView it by default keeps it on the left. So for a work around I have to add an empty ImageView first and then add my actual view next. Is there a way to only add one view and add it on right side of the cardView.

Tunous commented 2 years ago

Instead of adding 2 background views add one and give it android:layout_gravity="end". You can find example of such layout in the sample app.

AkankshaRana commented 2 years ago

Thanks It's working now. Earlier I was explicitly disabling the right swipe without adding the empty Left background view. So the app was crashing because of that.
swipeView.setDirectionEnabled(SwipeDirection.Right, false) It's working with one view after I remove the code to disable right swipe.