Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to config spinner with non-selected state. #126

Open
morozione opened this issue Oct 21, 2019 · 5 comments
Open

Add ability to config spinner with non-selected state. #126

morozione opened this issue Oct 21, 2019 · 5 comments

Comments

@morozione
Copy link

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.

@golnarSheikhBahaie
Copy link

u mean at the first no data was selected ?

@morozione
Copy link
Author

Yes

@golnarSheikhBahaie
Copy link

golnarSheikhBahaie commented Oct 22, 2019

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
Copy link

i hope it helps ;)

@morozione
Copy link
Author

morozione commented Oct 22, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants