drag-sort-listview
drag-sort-listview copied to clipboard
The floating item has black background when it should not
I came across with a strange issue when dragged item gets a black background even though the original item's background is transparent. I have also localized the problem, SimpleFloatViewManger.onCreateFloatView():
v.setDrawingCacheEnabled(true);
mFloatBitmap = Bitmap.createBitmap(v.getDrawingCache());
v.setDrawingCacheEnabled(false);
What i did, i just saved the mFloatBitmap to the sdcard and it had the black background. I thing the issue is with v.getDrawingCache(). I have replaced this code with this code snippet:
mFloatBitmap = Bitmap.createBitmap(v.getMeasuredWidth(), v.getMeasuredHeight(), Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(mFloatBitmap); v.draw(canvas);
And it solved the issue.
Or you can override the default float view background color. (which by default is black)
SimpleFloatViewManager simpleFloatViewManager = new SimpleFloatViewManager(mDragSortListView);
simpleFloatViewManager.setBackgroundColor(Color.TRANSPARENT);
mDragSortListView.setFloatViewManager(simpleFloatViewManager);
Hello, thanks for the reply. We are using a class that extends SimpleFloatViewManager. setBackgroundColor does not have any effect. The background color is always black. But with the above code, setBackgroundColor does work. It could be because we are using a custom layout for the rows of the list view.
I also use a custom layout for the list row items, that shouldn't matter.
DHuckaby, wahnker means that pretty complex layout is used. That might be the issue.
Thanks Dhuckaby.
Thank You ,It helps a lot