SpyZip
SpyZip

Reputation: 5540

DragShadowBuilder remove alpha

I'm using DragShadowBuilder for drag and drop but the moment I start the drag the view gets shaded with some alpha

I tried to set

View.DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(view);
shadowBuilder.getView().setAlpha(0);

but this sets the image not the shadowbuilder alpha. Ho can I remove the alpha?

Upvotes: 6

Views: 1043

Answers (1)

Amir Khorsandi
Amir Khorsandi

Reputation: 3708

This is an old question but for just being an answer to this question: you can use DRAG_FLAG_OPAQUE flag for API 24(N) and beyond, for older versions you need a custom implementation or at least custom drawing in a container view: link

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
    shadowBuilder.view.startDragAndDrop(emptyData, shadowBuilder, this, DRAG_FLAG_OPAQUE)
}

Upvotes: 8

Related Questions