MaterialSpinner icon indicating copy to clipboard operation
MaterialSpinner copied to clipboard

Add ability to config spinner with non-selected state.

Open morozione opened this issue 5 years ago • 5 comments

I my case I need to have a spinner with a no selected item from the data source(With empty field). So that users could select any item from all data sources.

morozione avatar Oct 21 '19 09:10 morozione

u mean at the first no data was selected ?

golnarSheikhBahaie avatar Oct 22 '19 06:10 golnarSheikhBahaie

Yes

morozione avatar Oct 22 '19 07:10 morozione

ok let me check . . u can create object with zero or null value at first . then add this value to ur spinner like this . for example u have Array List like this :

private static final String[] IRAN_TOWN = { "Tehran", "Isfahan", "Tabriz", }; MaterialSpinner spinner = (MaterialSpinner) findViewById(R.id.spinner); String[] BlankItem = new String[IRAN_TOWN.length + 1]; System.arraycopy(IRAN_TOWN, 0, BlankItem , 1, IRAN_TOWN.length); BlankItem [0] = ""; spinner.setItems(BlankItem);

golnarSheikhBahaie avatar Oct 22 '19 07:10 golnarSheikhBahaie

i hope it helps ;)

golnarSheikhBahaie avatar Oct 22 '19 08:10 golnarSheikhBahaie

Thanks for the solution but it seems like a crutch because after the user will select a second item then in second time spinner will show the next list of items: " ", "Tehran", "Tabriz". Maybe I'm looking for a solution which is directly in the library. I'm using this spinner in my production project many times and I'm looking for a clear solution.

morozione avatar Oct 22 '19 12:10 morozione