Skip to content

An android dropdown widget which allows to easily filter huge list of options

License

Notifications You must be signed in to change notification settings

rajasharan/SearchableSpinner

Repository files navigation

Android Searchable Spinner

An android dropdown widget which allows to easily filter huge list of options

Demo

Usage

Add the SearchableSpinner widget to your main layout file and provide an app:list string-array reference. See activity_main.xml

<com.rajasharan.widget.SearchableSpinner
    android:id="@+id/search"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:padding="5dp"
    app:list="@array/all_languages"
    />

Setup OnSelectionChangeListener

public class MainActivity extends ActionBarActivity implements SearchableSpinner.OnSelectionChangeListener {

    private SearchableSpinner mSpinner;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        mSpinner = (SearchableSpinner) findViewById(R.id.search);
        mSpinner.setOnSelectionChangeListener(this);
    }

    @Override
    public void onSelectionChanged(String selection) {
        Toast.makeText(this, selection + " selected", Toast.LENGTH_SHORT).show();
    }
}
The MIT License (MIT)

About

An android dropdown widget which allows to easily filter huge list of options

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages