Need help with swipe-button?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

456 Stars 100 Forks 149 Commits 44 Opened issues


A button that activates by swipe instead of touch

Services available


Need anything else?

Contributors list

Download Build Status


enter image description here

Library of an android button activated by swipe.

  • Easy to use.
  • Makes your app look great
  • Better UX in sensitive button


compile 'com.ebanx:swipe-button:[latestVersion]'

How to use

Add the button in your layout file and customize it the way you like it.

Setting the sliding button size

You can set the size of the moving part of the button by changing the app:buttonimagewidth and app:buttonimageheight properties.

Setting the text part size

You can set the size of the fixed part of the button by setting the text size of the setting the padding in this part.

Listening for changes

You can set a listener for state changes

SwipeButton enableButton = (SwipeButton) findViewById(;
enableButton.setOnStateChangeListener(new OnStateChangeListener() {
      public void onStateChange(boolean active) {
           Toast.makeText(MainActivity.this, "State: " + active, Toast.LENGTH_SHORT).show();

Or listen for the activation of the button

swipeButtonNoState.setOnActiveListener(new OnActiveListener() {
            public void onActive() {
                Toast.makeText(MainActivity.this, "Active!", Toast.LENGTH_SHORT).show();

Configure XML

  • buttonimagewidth: Change the width of the moving part of the button
  • buttonimageheight: Change the height of the moving part of the button
  • inner_text: Text in the center of the button. It disapears when swiped
  • innertextcolor: Color of the text
  • innertextsize: Size of the text
  • innertext[direction]_padding: Sets the padding of the text inside the button. You can set how big this part of the button will by setting text size and padding.
  • buttonimagedisabled: Icon of the button when disabled. This is the initial state.
  • buttonimageenabled: Icon of the button when disabled. This is the initial expanded state.
  • button[direction]padding: Sets the padding of the button the slide with the touch. You can set how big the button will be by setting the image and the padding
  • initial_state: Initial state. Default state is disabled.
  • hasactivatestate: Set if the button stops in the "active" state. If false, the button will only come back to the initial state after swiped until the end of its way. Use OnActiveListener if you set the parameter to false.
  • buttontrailenabled: Set trailing effect enabled.
  • buttontraildrawable: Set the color of the trailing effect.


If you would like to see a front-end version of this button you can check a codepen in this link:

  • (with Safari fix)

Bugs and features

For bugs, feature requests, and discussion please use GitHub Issues.


And that's it! Enjoy!

Written with StackEdit.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.