• Stars
    star
    276
  • Rank 149,319 (Top 3 %)
  • Language
    Java
  • License
    MIT License
  • Created over 9 years ago
  • Updated over 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An android layout to re-arrange child views via dragging

Android Rearrangeable Layout

An android layout to re-arrange child views via dragging

Android Arsenal

Screencast Demo

Layout Usage

All the child views are draggable once the layout is added to an activity (activity_main.xml)

<com.rajasharan.layout.RearrangeableLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/rearrangeable_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:clipToPadding="false"
    app:outlineWidth="2dp"
    app:outlineColor="@color/cyan"
    app:selectionAlpha="0.5"
    app:selectionZoom="1.2"
    >

    <!-- add child views with `android:id` attr to
         save position during orientation change -->

    <TextView
        android:id="@+id/textview_1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Sample Demo with very large text that will overflow in width"
        android:textSize="30sp"
        android:background="@android:color/holo_green_light"
        android:layout_margin="15dp"
        />

    <!-- more child views -->

</com.rajasharan.layout.RearrangeableLayout>

Child Position Listener

Add a ChildPositionListener to the root layout to receive updates whenever any child view is dragged (MainActivity.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

The MIT License (MIT)

More Repositories

1

SearchableSpinner

An android dropdown widget which allows to easily filter huge list of options
Java
207
star
2

NaughtyKeyboard-Android

The Big List of Naughty Strings is a list of strings which have a high probability of causing issues when used as user-input data. This is a keyboard to help you test your app from your Android device.
Java
35
star
3

moving-averages-chartjs

Simple Moving Averages (with Chart.js)
JavaScript
8
star
4

Android-BezierCurve-sample

Java
6
star
5

angular-us-map

An angular module to show data while hovering over different US states.
JavaScript
5
star
6

ng2-healthcheck

angular2 health check ping module using svg animations
TypeScript
2
star
7

hashtable

64-bit hashtable implementation with memory profiler
C
2
star
8

Android-TileLayout

An android layout to load Tiles asynchronously using AsyncAdapter<T>. Reference implementation of SimpleTileAdapter provided.
Java
2
star
9

ScreenshotLayer

An intuitive way to take screenshots in android using custom layout
Java
2
star
10

IconicLabelView

An expandable label view with icon for Android (similar to the way Gmail shows its email labels)
Java
2
star
11

RevealPictureView

An android widget to reveal & collapse an image.
Java
2
star
12

Android-MenubarLayout

An android layout to easily add menubar style navigation
Java
1
star
13

CameraPeekPreview

Easily peek into the android camera preview and snap pictures
Java
1
star
14

java8-easy-monads

Simple Monad implementations for java 8
Java
1
star
15

foreach

foreach utility function for C language
C
1
star
16

elm-freehand-drawing

freehand drawing tool built with elm
JavaScript
1
star
17

unicode-utility

UTF-8 string utility functions in C
C
1
star
18

elm-countdown-problem

Solution for the countdown-problem in elm
Elm
1
star
19

yt-sync

Youtube Sync & Watch together
JavaScript
1
star
20

javascript-bytes

Byte, Hex, Base64 manipulation in javascript
JavaScript
1
star