Skip to content
Drag and drop GridView for Android
Java
Branch: master
Clone or download
Latest commit f81c028 Feb 16, 2016
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
dynamicgrid Merge pull request #54 from hzsweers/master Feb 1, 2015
example Cleanup and update build.gradle files for modules Dec 8, 2014
gradle/wrapper
.gitignore Update .gitignore Dec 8, 2014
LICENSE Initial commit Sep 9, 2013
README.md Update README.md Feb 16, 2016
build.gradle Update gradle plugin to latest 1.0 RC, add local gradle wrapper to ea… Dec 8, 2014
settings.gradle added main gradle project Jul 6, 2014

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.

You can’t perform that action at this time.