The Android Arsenal – Spinners

Android Spinner support hint

Adding to project

Gradle

Add below code to your root build.gradle file

allprojects 
    repositories 
        maven  url 'https://jitpack.io' 
    

And add the following dependency code to your module‘s build.gradle file.

dependencies 
    implementation 'com.github.Mamoon-Alhawamdeh:AmazingSpinner:$latest-version"

Usage

<com.google.android.material.textfield.TextInputLayout
        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="16dp"
        android:layout_marginRight="16dp">

        <com.rosemaryapp.amazingspinner.AmazingSpinner
            style="@style/Widget.MaterialComponents.AutoCompleteTextView.OutlinedBox"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="hint"/>

    </com.google.android.material.textfield.TextInputLayout>

OR

<com.rosemaryapp.amazingspinner.AmazingSpinner
        style="@style/Widget.AppCompat.Spinner.Underlined"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="16dp"
        android:layout_marginRight="16dp"
        android:hint="hint"/>

Inside Activity Or Fragment

mAmazingSpinner1.onItemClickListener =
AdapterView.OnItemClickListener  adapter, v, position, id ->

                Toast.makeText(this, adapter.getItemAtPosition(position).toString(), Toast.LENGTH_LONG).show()

            

OR

mAmazingSpinner1.text.toString()

Customization

You can use TextInputLayout styles and properties or Spinner styles and properties.

Find this library useful? ❤️

Support it by joining stargazers for this repository. ⭐

MIT License

Copyright (c) 2020 Mamoon Al-hawamdeh

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Next Post

Fospha’s Insights to Unlock eCommerce Growth in 2024

In the ever-evolving landscape of eCommerce, staying ahead requires constant adaptation and strategic insights. The Fospha State of eCommerce Report for Q1 2024 brings valuable data to the forefront, guiding marketers, advertisers, business owners, and agencies in the eCommerce industry on where to channel their efforts for maximum return.   The […]
Fospha’s Insights to Unlock eCommerce Growth in 2024

You May Like