How to create multiple view with drag and drop functunality in Android

This tutorial will help to the develop the Drag and Drop functionality, individual can create multiple view in their android application. Each view will have different onTouchListener and onLongClickListener.

Step 1- Create a XML file res/activity_main.xml

  1. <Button
  2. android:id=”@+id/button”
  3. android:layout_width=”200dp”
  4. android:layout_height=”100dp”
  5. android:text=”Button View” />
  6. <AbsoluteLayout
  7. android:id=”@+id/boardLayout”
  8. android:layout_width=”match_parent”
  9. android:layout_height=”match_parent”
  10. android:background=”@drawable/board”
  11. android:gravity=”center”
  12. android:padding=”20dp” >
  13. </AbsoluteLayout>

Step-2 Create a Activity called src/MainActivity

  1. import android.app.Activity;
  2. import android.content.ClipData;

Here is not the end….. To view the full blog about How to create multiple view with drag and drop functunality in Android visit Findnerd.

Explore findnerd for its various other special features like Desktop recording tool, Session Tracker Tool, Project Management tool etc.