Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rajasharan/rearrangeablelayout
An android layout to re-arrange child views via dragging
https://github.com/rajasharan/rearrangeablelayout
Last synced: 3 days ago
JSON representation
An android layout to re-arrange child views via dragging
- Host: GitHub
- URL: https://github.com/rajasharan/rearrangeablelayout
- Owner: rajasharan
- License: mit
- Created: 2015-06-21T17:27:09.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-07-01T01:31:08.000Z (over 9 years ago)
- Last Synced: 2023-11-07T16:50:23.622Z (about 1 year ago)
- Language: Java
- Homepage:
- Size: 8.71 MB
- Stars: 276
- Watchers: 17
- Forks: 57
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Android Rearrangeable Layout
An android layout to re-arrange child views via dragging[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-RearrangeableLayout-green.svg?style=flat)](https://android-arsenal.com/details/1/2037)
## Screencast Demo
![](/screencast.gif)## Layout Usage
All the child views are draggable once the layout is added to an activity
([activity_main.xml](/demo/src/main/res/layout/activity_main.xml))
```xml
```
## Child Position Listener
Add a `ChildPositionListener` to the root layout to receive updates whenever any child view is dragged
([MainActivity.java](/demo/src/main/java/com/rajasharan/demo/MainActivity.java))
```java@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);root = (RearrangeableLayout) findViewById(R.id.rearrangeable_layout);
root.setChildPositionListener(new RearrangeableLayout.ChildPositionListener() {
@Override
public void onChildMoved(View childView, Rect oldPosition, Rect newPosition) {
Log.d(TAG, childView.toString());
Log.d(TAG, oldPosition.toString() + " -> " + newPosition.toString());
}
});
}
```## [License](/LICENSE)
The MIT License (MIT)