I’m using RecyclerView and ItemTouchHelpter to detect swipe gestures.
In some applications, I have seen the user swipes the item (and it won’t go further than almost 50 % of the screen), and a background animation starts playing. When the user releases the item, there is a smooth vibration, and the foreground item will back to its first position.
I found out for set limitation for swipe width; I can set dX in
val foregroundView: View? = viewHolder.itemView.findViewById(R.id.view_foreground) getDefaultUIUtil().onDraw( c, recyclerView, foregroundView, dX / 2, dY, actionState, isCurrentlyActive )
now, I am wondering how I can reverse, swipe animation, and bring the foreground view back to its first position(at this point, it will go beyond the screen, and because I limited the dX, it is shown half in screen and half out of the screen while I want it backs to the first position after calling
Source: Android Questions