Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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)