Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/askerov/DynamicGrid
Drag and drop GridView for Android
https://github.com/askerov/DynamicGrid
Last synced: about 2 months ago
JSON representation
Drag and drop GridView for Android
- Host: GitHub
- URL: https://github.com/askerov/DynamicGrid
- Owner: askerov
- License: apache-2.0
- Archived: true
- Created: 2013-09-09T17:59:04.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2018-05-22T08:00:18.000Z (over 6 years ago)
- Last Synced: 2024-07-31T18:16:34.676Z (4 months ago)
- Language: Java
- Size: 271 KB
- Stars: 927
- Watchers: 50
- Forks: 288
- Open Issues: 51
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- -awesome-android-ui - DynamicGrid
- awesome-android-ui - DynamicGrid
- awesome-github-android-ui - DynamicGrid - Android可拖拽GridView (Sort&Drag)
- awesome-android-ui - DynamicGrid
- awesome-android-ui - https://github.com/askerov/DynamicGrid
- awesome-android-ui - https://github.com/askerov/DynamicGrid
README
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-advancedrecyclerviewDemo
----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](https://github.com/askerov/DynamicGrid/blob/master/dynamicgrid/src/org/askerov/dynamicgid/AbstractDynamicGridAdapter.java "AbstractDynamicGridAdapter")
or [BaseDynamicGridAdapter](https://github.com/askerov/DynamicGrid/blob/master/dynamicgrid/src/org/askerov/dynamicgid/BaseDynamicGridAdapter.java "BaseDynamicGridAdapter")
```java
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:```java
gridView.startEditMode();
```
Or from onItemClik() and onItemLongClick()```java
gridView.startEditMode(position);
```
To stop:```java
gridView.stopEditMode();
```
Adding drop listener:```java
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](https://github.com/askerov/DynamicGrid/tree/master/example).
Credits
--------
DynamicGridView based on [Daniel Olshansky](https://plus.google.com/108153578400873445224/) ListView cell dragging and rearranging [example](https://www.youtube.com/watch?v=_BZIvjMgH-Q).