How to change the name of my Spinner Menu

I am wondering if it is possible to change the title text in my Spinner menu?

I see the identifier of the request header field in the component, but I do not know if it is possible to avoid it, because it always accepts the data of the first row from my array list ....

spinner = (Spinner) findViewById(R.id.spinner);
        ArrayAdapter<String> adapter = new ArrayAdapter<String>(
                this, 
                android.R.layout.simple_spinner_item, 
                CategoriesConsumer.categories);
        adapter.setDropDownViewResource(android.R.layout.simple_spinner_item);
        spinner.setAdapter(adapter);
+3
source share
2 answers

Hm?

If I am mistaken, you have already mentioned this. For XML inside the Spinner component:

android:prompt="This is my title"

And in the code:

spinner.setPrompt("This is my title");

Not sure what you mean to avoid using string data from your ArrayList ...

+2
source

I believe that you are looking for a second answer to this question: (and not accepted) How to make Android Spinner with the "Choose one" source code

0
source

All Articles