Android: How to eliminate space between each entry in a Spinner?

0

I have a spinner where I want to put the horoscopes name. However, the name of horoscopes appears with a blank line separating each horoscope when I "open" the spinner. More or less like this:

-linha em branco-
Geminis
-linha em branco-
Cancer
-linha em branco-

Can anyone tell me how I can narrow the space between the names of each horoscope? My code is this:

strings.xml

<string-array name="horoscope_array">
        <item>Aquarius</item>
        <item>Pisces</item>
        <item>Aries</item>
        <item>Taurus</item>
        <item>Gemini</item>
        <item>Cancer</item>
        <item>Leo</item>
        <item>Virgo</item>
        <item>Libra</item>
        <item>Scorpius</item>
        <item>Sagitarius</item>
        <item>Capricorn</item>
    </string-array>

<string name="horoscope_prompt">Choose a Horoscope</string>

In my layout.xml I have:

<Spinner
android:layout_height="35dp"
android:id="@+id/spinner1"
android:layout_width="match_parent"
android:entries="@array/horoscope_array"
android:textColor="@color/orange"
android:prompt="@string/horoscope_prompt" />
    
asked by anonymous 15.05.2016 / 19:39

1 answer

0

Look, it looks okay, but I do not know how your class is, but it should look something like this

Spinner spinner;

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.teuLayout);        
    spinner = (Spinner)findViewById(R.id.spinner);

    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.horoscope_array, android.R.layout.simple_spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spinner.setAdapter(adapter);

}
    
19.05.2016 / 16:08