我在FragmentViewPagerAdapter
. 在这里,Recyclerview
我实现ItemTouchHelper
了一个没有发生的滑动。有没有人遇到过这个问题。
由于 viewpageradapter 滑动操作,无法使用 itemtouchhelper 滑动功能。
public SwipeHelper(ListAdapter adapter, Context context) {
super(0, ItemTouchHelper.RIGHT);
this.adapter = adapter;
this.context = context;
}
public SwipeHelper(int dragDirs, int swipeDirs) {
super(dragDirs, swipeDirs);
}
@Override
public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder target) {
return false;
}
@Override
public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) {
Toast.makeText(context, "swipe", Toast.LENGTH_LONG).show();
}
ItemTouchHelper.Callback callback = new SwipeHelper(adapter,getActivity());
ItemTouchHelper helper = new ItemTouchHelper(callback);
helper.attachToRecyclerView(leadRV);