Android Drag-Drop Button - A custom component for android developers

See on Github

This is an open source android drag button custom component. You can use it on your project to show a drag-able icon and perform any action after user dragged to the edge of the component.

drag drop button screenshot

Import aar file on releases directory to your android project to include drag-drop button. Or you can download entire project and open from Android studio and compile to match with your sdk version, then you can import generated aar file to your real project.

Example usage of the drag-drop-button

This is a sample code for drag button inserting into ui and handling events.

xml code to put drag-drop button on the activity

Needs to define custom namespace on parent tag as

See activity_main.xml on test project for complete source code.

Java code to handle events
DragButton dragButton = (DragButton) findViewById(;
dragButton.setOnDraggedListener(new DragButton.OnDraggedListener() {
    @Override    public void onDragged(DragButton view, MotionEvent e) {
        Log.i("DragBtn", "Dragged");
dragButton.setOnDragStartedListener(new DragButton.OnDragStartedListener() {
    @Override    public void onDragStarted(DragButton view, MotionEvent e) {        
        Log.i("DragBtn", "Drag started");
dragButton.setOnDragEndedListener(new DragButton.OnDragEndedListener() {
    @Override    public void onDragEnded(DragButton view, MotionEvent e) {
        Log.i("DragBtn", "Drag ended");
See on test project for complete source code.

Custom Attributes on xml

Size of the center icon to draw related to the size of the button. Example- 1 will draw the center icon on entire button, 0.5 will draw half of the size of the button. Any value between 0-1.

Indicate the percentage area of the threshold to fire the dragged event. Any value between 0-1.

Number of arrow to show the drag direction. Any positive integer value

Color of the arrows in hex format. Example- #42f46e

Path to the image file for center icon on assert folder. 512x512 is the recommended size. 
Example- icon2.png


  1. Rankings and reviews of the best Digital Marketing companies and agencies in Noida, India based on a meticulous evaluation process. Click here:

  2. Business Promotion specializes in custom and dental website design, web marketing, social media management, and more that turns visitors into customers. Click Here:

  3. localization testing services Delhi

  4. Very nice blog keep it up

  5. If AOL is to be logged out of all your devices then on your AOL account open“settings” then click “password and security” then in the logged in sessions you will get to see the list of devices where you are logged in then to log out of those devices enter password and click “unlock button.”