If you have more values on Dropdown of Spinner its hard to select the last item by making a long scroll.
To overcome this issue Android introduced a component called AutoCompleteTextView
Yes it is!!! Then why Spinner with Search?
There may be some requirement even though gave much knowledge about it.
There is a simple and good library that helps us to achieve this - SearchableSpinner
To overcome this issue Android introduced a component called AutoCompleteTextView
Yes it is!!! Then why Spinner with Search?
There may be some requirement even though gave much knowledge about it.
There is a simple and good library that helps us to achieve this - SearchableSpinner
Gradle
dependencies {
...
implementation 'com.toptoche.searchablespinner:searchablespinnerlibrary:1.3.1'
}
Usage
Now replace your Normal Android Spinner on XML with the following
<com.toptoche.searchablespinnerlibrary.SearchableSpinner
android:id="@+id/id_city"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:padding="5dp" />
_________________________________________________________________________
Happy Coding...
Comments
Post a Comment