In the last Android library section, we saw the Direct Select DropDown library. By using this Android library you can give a unique look to your application. But if you want to implement spinner instead of a drop-down. Then this Android Swipe-able Spinner is good for you.
Here is another look at the touch of classic controls. Arrows on the UI work in the usual way. You can click on the top arrow to increase the value of the stepper and click on the bottom arrow to decrease one. In most cases, it’s appropriate for desktop-based interfaces where you have a particular controller allowing you to interact with the UI precisely (mouse or trackpad, for example).
The interaction allows us to use the control in touch interfaces without modification of its appearance. Sure, it’s not 100 percent obvious that the UI might be used in a way it’s shown on the shot.
[tmh_article_ads]
We could consider the arrows as signifiers, that you can swipe down/up the UI, but we should have context. So, the approach demands a convention throughout whole UX that any UI whenever a user comes across it, is capable of being used in this way.
Implement Android Swipe-able Spinner
A helper class which turns any existing recycler view to a spinner that allows the user to scroll the whole list through a single dragging gesture. The use of recycler view ensures better performance and better long-term support.
It is a helper class to create recyclerview-based fast-scrolling spinner. Both vertical and horizontal scrolling are supported; set the orientation by using LinearLayoutManager.setOrientation(int).
Customization is not included in the helper class; check the companion demo app to see how to add indication arrows and for other tricks.
Compatibility
The helper class is backward-compatible the same way as RecyclerView. The demo app is Lollipop+ due to vector drawables.
Demo & Download
Dependency
Add dependencies ‘com.android.support:support-dynamic-animation‘ and ‘com.android.support:recyclerview-v7‘
implementation 'com.android.support:support-dynamic-animation:27.1.1' implementation 'com.android.support:recyclerview-v7:27.1.1'
Copy Helper class
Copy SwipeSpinnerHelper.Java class to your app.
Use the Library in your project
Bind recycler view objects to SwipeSpinnerHelper class using a static method.
SwipeSpinnerHelper.bindRecyclerView(recyclerView)
You can use this with any RecyclerView object as long as you use LinearLayoutManager.
Share your experience
After implementing this Android Swipe-able Spinner library, share your experience with us. And if you got any queries regarding library then comment us below.
Share your thoughts