Drag and drop GridView for Android

Min SDK   8
Latest Commit   2016-02-16 09:12:16
License   Apache-2.0

Github   https://github.com/askerov/DynamicGrid

         

标签

使用APP客户端扫描二维码运行Demo


         

类似的还有....
DraggableGridView A drag-and-drop scrolling grid view for Android
PinterestLikeAdapterView [Deprecated] An Android multi column list view like Pinterest.
StickyGridHeaders This project has been superseded by SuperSLiM, a layout manager for RecyclerView. I strongly recommend using SuperSLiM and not StickyGridHeaders.
README

README.md

DynamicGrid

Drag and drop GridView for Android.

Depricated

It's much better to use solutions based on recycler view. For example https://github.com/h6ah4i/android-advancedrecyclerview

Demo

example

Requirements

Rearranging items require api 8 (Froyo). All grid item animations require api 11 (Honeycomb).

Usage

All the same as for normal GridView. Adapter must extends AbstractDynamicGridAdapter or BaseDynamicGridAdapter

gridView = (DynamicGridView) findViewById(R.id.dynamic_grid);
// pass to adapter context, list of items and number of columns count
gridView.setAdapter(new MyDynamicGridAdapter(this, itemsList, 3));

To start Drag'n'drop mode:

gridView.startEditMode();

Or from onItemClik() and onItemLongClick()

gridView.startEditMode(position);

To stop:

gridView.stopEditMode();

Adding drop listener:

gridView.setOnDropListener(new DynamicGridView.OnDropListener(){
    @Override
    public void onActionDrop(){
        // stop edit mode immediately after drop item
        gridView.stopEditMode();
        }
    });

You can find more detailed usage example here.

Credits

DynamicGridView based on Daniel Olshansky ListView cell dragging and rearranging example.