Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 220
SpyZip Avatar asked Jun 07 '17 14:06

SpyZip


1 Answers

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)
}
like image 91
Amir Khorsandi Avatar answered Nov 15 '22 03:11

Amir Khorsandi