public final void startDrag(View.DragShadowBuilder dragShadowBuilder) { Point shadowSize = new Point(); Point shadowTouchPoint = new Point(); dragShadowBuilder.onProvideShadowMetrics(shadowSize, shadowTouchPoint); itemView.startDrag( null, dragShadowBuilder, new DragInfo(getItemId(), shadowSize, shadowTouchPoint, adapter.getLastTouchPoint()), 0); adapter.notifyItemChanged(getAdapterPosition()); }
@Override public void onProvideShadowMetrics(Point shadowSize, Point shadowTouchPoint) { super.onProvideShadowMetrics(shadowSize, shadowTouchPoint); // Double the height and width int height = getView().getHeight() * 2; int width = getView().getWidth() * 2; mBitmapDrawable.setBounds(0, 0, width, height); shadowSize.set(width, height); // Set the touch point to the middle shadowTouchPoint.set(width / 2, height / 2); }