0
Hello, I’m trying to make a spinner with the options: "Open Today" and "It doesn’t matter".
In my layout, I do not want anything written and a clock icon to appear, when clicked, load the spinner list.
I put the image in the background of the spinner.
It turns out that it expands as selected the option from the list, will have to leave it of fixed size?
And also the other question is that the list with the options can be added only at position 1, because as I do not know this, I am adding the first element of the list as "" so that in the layout is only the image.
I tried to put as listheader, but it didn’t work. Thank you very much! What I am using:
No Layout:
<Spinner
android:id="@+id/spinner3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center_horizontal"
android:scrollIndicators="end"
android:textAlignment="center"
android:background="@drawable/local" />
No código:
horario = new ArrayList<>();
horario.add("");
horario.add("Aberto Hoje");
horario.add("Não importa");
adapter = new ArrayAdapter<String>(getApplication(), android.R.layout.simple_spinner_dropdown_item, horario);
spinnerhora.setAdapter(adapter);
You can put an imageview underneath the spinner. Before the user clicks the spinner, make it invisible.
– Tiago P Casemiro
Hi Tiago, it’s a good idea, but how do I (in code) so that when the user click on Imageview open the spinner?
– Elaine Breda Schwaner