https://github.com/rajasharan/RearrangeableLayout
An android layout to re-arrange child views via dragging
https://github.com/rajasharan/RearrangeableLayout
Last synced: 5 months 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 (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-07-01T01:31:08.000Z (almost 10 years ago)
- Last Synced: 2024-11-13T15:13:59.958Z (5 months ago)
- Language: Java
- Homepage:
- Size: 8.71 MB
- Stars: 273
- Watchers: 17
- Forks: 57
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-android-ui - https://github.com/rajasharan/RearrangeableLayout
- awesome-android-ui - https://github.com/rajasharan/RearrangeableLayout
README
# Android Rearrangeable Layout
An android layout to re-arrange child views via dragging[](https://android-arsenal.com/details/1/2037)
## Screencast Demo
## 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)