Guide · Open source
How to use AndroidSwipeLayout: add swipe-to-reveal actions to Android lists
Updated · written with AI from the project's own documentation and checked against our catalogue data
AndroidSwipeLayout is a Java library for Android apps that wraps a list item so the user can swipe it to reveal hidden buttons or content, such as delete or more-options actions. This guide is for Android developers who want swipe actions in a list without writing touch handling by hand. By the end you will know what the library does, how its dependency is declared, the one adapter rule the README stresses, and where it may not fit your project.
Quick start
- 1Confirm your project setup. Make sure you have Android Studio or a Gradle build for an Android project. Check that your current support library versions are compatible with the README's examples.
- 2Add the Gradle dependency. Add the library line from the README to your module's dependencies block and sync the project.
- 3Wrap your list item. Place the swipe layout around the row content you want to swipe, with the hidden actions underneath.
- 4Use the internal adapter. Follow the README's Step 2 and the wiki usage page rather than writing your own adapter.
- 5Handle open, close, and update callbacks. Use the callbacks to react when a row opens, closes, or updates, such as saving state or updating the list.
- 6Test on a device or emulator. Swipe rows in each container you use to confirm the behavior and check for compatibility issues.
What AndroidSwipeLayout does
The library lets you wrap a list item or view so the user can swipe it to uncover content underneath. The README says it is meant to work in many containers, not only ListView, and the author lists goals including integration in ListView, GridView, or other ViewGroups.
It exposes open, close, and update callbacks, so your code can react when a row opens or closes. The README also says hidden children can be told how much of them has been shown, and that layouts can be nested.
- Swipe a row to reveal buttons such as delete or more options
- Works with ListView, GridView, and ViewGroup containers according to the README
- Callbacks: onOpen, onClose, onUpdate
Add the dependency to your Android project
The README shows the dependency in Gradle form. Its examples also list older support libraries, so check that your project's versions are compatible before copying them. The README's example lines are shown below as written.
The README also shows Maven and an Eclipse jar, but the Gradle entry is the package-manager route the source documents. Prerequisites are Android Studio or a Gradle build setup for an Android project.
- Add the library line to the dependencies block of your module's build file
- Keep the support library versions in mind; the README's examples are old
compile "com.daimajia.swipelayout:library:1.2.0@aar"Use the internal adapter
The README's Step 2 says to use the library's internal adapter instead of your own. It links to the project wiki for usage details, so read that page before wiring the library into a custom adapter.
The wiki is the source for the detailed usage pattern. This guide does not reproduce wiki code, since the README excerpt provided does not include it.
- Read the Wiki usage page linked from the README
- Do not swap in your own adapter without checking the wiki first
Check whether it fits your project
The library is Android-only and written in Java. The README's dependency examples use old support libraries, and the last push noted in the analysis was 2023-11-10, so confirm it builds with your current Android tooling before committing.
Setup assumes familiarity with Gradle and Android views. If you are new to Android, expect to learn those first.
- Not for iOS, web, or other platforms
- Verify compatibility with current Android tooling before adopting
- Assumes Gradle and Android view knowledge
Compare with similar libraries
The README names SwipeListView as a predecessor that only works in ListView, which is why this library aims for broader containers. Other comparable projects listed for this item are SwipeMenuListView and SwipeRevealLayout.
Pick based on your container type, licence needs, and how recently each project has been maintained.
- SwipeListView: ListView-focused, per the README
- SwipeMenuListView and SwipeRevealLayout: comparable projects to evaluate
What people use it for
- Swipe-to-delete on rows in a ListView or RecyclerView-style list
- Revealing a more-options menu from a list item
- Adding swipe behavior to items in a GridView
Frequently asked questions
Is AndroidSwipeLayout free to use?
The project is licensed under MIT, as listed in the analysis for this directory entry. Check the LICENSE file in the repository to confirm the terms before shipping.
What do I need to install AndroidSwipeLayout?
You need Android Studio or a Gradle build setup for an Android project. The library is added as a Gradle dependency in the README's Step 1.
Does AndroidSwipeLayout work with RecyclerView?
The analysis lists RecyclerView-style lists as a best-fit use case, and the README lists the recyclerview-v7 support library in its example dependencies. Confirm the adapter guidance in the wiki for your setup.
Why does the README say to use the internal adapter?
The README's Step 2 says to use the internal adapter instead of your own, and links to the wiki usage page. The source excerpt does not explain the reasoning, so read the wiki for details.
What are alternatives to AndroidSwipeLayout?
Comparable projects named for this item are SwipeListView, SwipeMenuListView, and SwipeRevealLayout. SwipeListView is described in the README as working only in ListView.
Is AndroidSwipeLayout still maintained?
The analysis notes the last push was 2023-11-10 and that the README's examples use old support libraries. Check the repository's recent activity and issues before relying on it for a new project.
New agent skills, repos and AI tools — every week
The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.
Our verdict
AndroidSwipeLayout suits Android developers who want an MIT-licensed, drop-in swipe-to-reveal component for list rows and can work with Gradle and Android views. Skip it if you need an actively updated library for current Android tooling, work outside Android, or are new to Android development, and compare SwipeMenuListView or SwipeRevealLayout first.
Install options & downloads