0

I need to put different lines in a Spinner I tried to put in the xml file android:singleLine="false" and writing \n as you can see in the example but nothing work. What I need exactly isn't just to adjust the text for see it correctly. I need to specify when I want to jump line.

Here is the format of each option in the Spinner I want:


TITLE: XXXXX "\n"
property1: xxxx property2: xxxx

Here is a resume of my code:

s2 = (Spinner) findViewById(R.id.spinner2);

adapter2 = new ArrayAdapter(Activity_introducir.this,android.R.layout.simple_spinner_item,nomactivitats(s.getSelectedItem().toString()));
s2.setAdapter(adapter2);


private ArrayList nomactivitats(String nomproj) {
...
array_activitats.add(cc.getString(3) + " \n  Example Text in next line");
...
return array_activitats;
}
thegrinner
  • 11,546
  • 5
  • 41
  • 64
benLIVE
  • 597
  • 3
  • 14
  • 29
  • see where it says `android.R.layout.simple_spinner`? What you need to do is make your own spinner layout that accepts it. – Vic Vuci May 16 '13 at 17:39
  • 1
    This question has already been [answered][1]. [1]: http://stackoverflow.com/questions/6107500/how-to-wrap-lengthy-text-in-a-spinner – Roy Hinkley May 16 '13 at 18:36
  • Just look around for tutorials on how to make your own spinner in Android. You can create the whole format of a row in your Spinner. [Here's](http://stephenpengilley.blogspot.in/2013/01/android-custom-spinner-tutorial.html) one. – AndyFaizan May 16 '13 at 18:35

0 Answers0