PixSlideBar
A modern and smooth slider-bar style button library for Android. Users slide the button to the end to perform an action, providing a more intentional and engaging interaction than a simple tap.
Tech Stack
What is PixSlideBar?
PixSlideBar is an Android UI library that provides a “slide to confirm” style button component. Instead of a simple tap, users must slide the button all the way to the end to trigger an action. This pattern is commonly used for:
- Confirming destructive actions (delete, cancel)
- Unlocking/starting important workflows
- Preventing accidental taps
- Creating more engaging user interactions
Key Features
- Smooth Animations: Fluid sliding motion with modern design
- Customizable: Configure colors, text, icons, and dimensions
- Easy Integration: Drop-in XML layout component
- Callback Support: Simple interface for handling slide completion
- Material Design: Follows Android design guidelines
Installation
Via JitPack
Add JitPack to your project-level build.gradle:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Add the dependency to your app-level build.gradle:
dependencies {
implementation 'com.github.amannirala13:PixSlideBar:{Latest_version}'
}
Via JCenter
dependencies {
implementation 'com.amannirala13.pixslidebar:PixSlideBar:{Latest_version}'
}
Usage
Add to XML Layout
<com.amannirala13.pixslidebar.PixSlideBar
android:id="@+id/my_slide_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:message="Slide to confirm" />
Handle Slide Complete Event
slideBar.addOnSlideCompleteRunner(object: Runner {
override fun execute() {
Toast.makeText(
this@MainActivity,
"Slide Complete",
Toast.LENGTH_SHORT
).show()
}
})
Use Cases
- Order Confirmation: “Slide to place order”
- Account Deletion: “Slide to delete account”
- Payment Authorization: “Slide to pay”
- Alarm Dismissal: “Slide to dismiss”
- Unlock Actions: “Slide to unlock”
Why Slide-to-Confirm?
Traditional tap buttons can lead to accidental actions, especially on mobile devices. The slide-to-confirm pattern:
- Requires intentional user action
- Reduces accidental triggers
- Provides visual feedback during the action
- Creates a more memorable interaction
- Is familiar from iOS “slide to unlock” patterns