Skip to content

Instantly share code, notes, and snippets.

@bgogetap
Created October 20, 2015 06:11
Show Gist options
  • Save bgogetap/7e1d65c2c4494af0dc51 to your computer and use it in GitHub Desktop.
Save bgogetap/7e1d65c2c4494af0dc51 to your computer and use it in GitHub Desktop.
View.DragShadowBuilder that takes in a Point ((int) event.getX(), (int) event.getY()) so your dragged shadow is positioned correctly
public static class MyDragShadowBuilder extends View.DragShadowBuilder {
private final Point offset;
public MyDragShadowBuilder(View view, Point offset) {
super(view);
this.offset = offset;
}
@Override
public void onProvideShadowMetrics(Point shadowSize, Point shadowTouchPoint) {
shadowSize.set(getView().getWidth(), getView().getHeight());
shadowTouchPoint.set(offset.x, offset.y);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment