Name: DynamicGrid
Owner: bilibili
Description: Drag and drop GridView for Android
Created: 2015-03-26 02:27:00.0
Updated: 2018-03-12 20:05:48.0
Pushed: 2015-03-26 04:18:17.0
Homepage: null
Size: 348
Language: Java
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Drag and drop GridView for Android.
Rearranging items require api 8 (Froyo). All grid item animations require api 11 (Honeycomb).
All the same as for normal GridView. Adapter must extends
AbstractDynamicGridAdapter
or BaseDynamicGridAdapter
View = (DynamicGridView) findViewById(R.id.dynamic_grid);
ass to adapter context, list of items and number of columns count
View.setAdapter(new MyDynamicGridAdapter(this, itemsList, 3));
To start Drag'n'drop mode:
View.startEditMode();
Or from onItemClik() and onItemLongClick()
View.startEditMode(position);
To stop:
View.stopEditMode();
Adding drop listener:
View.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.
DynamicGridView based on Daniel Olshansky ListView cell dragging and rearranging example.