Code example for View.DragShadowBuilder

0
 
public final class MyTouchListener implements OnTouchListener {
	public boolean onTouch(View view, MotionEvent motionEvent) {
		if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
			ClipData data = ClipData.newPlainText("", "");
			DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(
					view);
			view.startDrag(data, shadowBuilder, view, 0);
			view.setVisibility(View.VISIBLE);
			return true; 
		} else { 
			return false; 
		} 
	} 
} 
Experience pair programming with AI  Get Codota for Java