Android 从RecyclerView适配器拖动视图以查看容器内部片段

Android 从RecyclerView适配器拖动视图以查看容器内部片段,android,android-fragments,drag-and-drop,android-recyclerview,Android,Android Fragments,Drag And Drop,Android Recyclerview,我在Fragment中有RecyclerView,我想从回收器适配器中拖动行,并将其放入容器Fragment中的视图中“同一片段中的回收器和视图,我尝试了stack和youtube中的许多代码,我使用这些代码来实现拖放,但它只在适配器外面的视图中起作用 private class ChoiceTouchListener implements View.OnTouchListener { RowNewsRecylcerHolder holder; public ChoiceT

我在
Fragment
中有
RecyclerView
,我想从
回收器
适配器
中拖动行,并将其放入容器
Fragment
中的视图中“同一片段中的
回收器
视图
,我尝试了stack和youtube中的许多代码,我使用这些代码来实现拖放,但它只在适配器外面的视图中起作用

private class ChoiceTouchListener implements View.OnTouchListener {
    RowNewsRecylcerHolder holder;



    public ChoiceTouchListener(RowNewsRecylcerHolder holder) {
        this.holder = holder;

    }

    @Override
    public boolean onTouch(View v, MotionEvent event) {
        final int X = (int) event.getRawX();
        final int Y = (int) event.getRawY();
        switch (event.getAction() & MotionEvent.ACTION_MASK) {
            case MotionEvent.ACTION_DOWN:
                LinearLayout.LayoutParams lParams = (LinearLayout.LayoutParams) v.getLayoutParams();
                _xDelta = X - lParams.leftMargin;
                _yDelta = Y - lParams.rightMargin;

                break;
            case MotionEvent.ACTION_UP:
                break;
            case MotionEvent.ACTION_POINTER_DOWN:
                break;
            case MotionEvent.ACTION_POINTER_UP:
                break;
            case MotionEvent.ACTION_MOVE:
                LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) v.getLayoutParams();
                layoutParams.leftMargin = X - _xDelta;
                layoutParams.topMargin = Y - _yDelta;
                layoutParams.rightMargin = 250;
                layoutParams.bottomMargin = 250;
                v.setLayoutParams(layoutParams);


                break;


        }
        holder.getRowCardViewContent().invalidate();
        return true;
    }
}

@你能发布一个代码示例吗?因为我尝试过,但无法将项目拖动到RecyclerView大小之外。-请注意,在测试设备或模拟器上需要1+个视频,因为示例应用程序查询
MediaStore
以获取可用视频,并在
RecyclerView
@commonware中显示这些视频,非常感谢。现在,当我松开手时,我想操作拖动的项目。因为我想在拖动的物品触碰某个按钮时进行操作。你能帮我吗?