I have two spinners, one above each other, like this:
<Spinner
android:layout_height="wrap_content"
android:id="@+id/CitySpinner"
android:layout_width="fill_parent"
android:prompt="@string/city_prompt"
/>
<Spinner
android:layout_height="wrap_content"
android:id="@+id/CountrySpinner"
android:layout_width="fill_parent"
android:prompt="@string/country_prompt"
/>
I set them like this
// set the data adapter for the city spinner
spnCity = (Spinner) findViewById(R.id.CitySpinner);
SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,
R.layout.simple_spinner_item,
mDbHelper.getCities(),
new String[] { KEY_CITY },
new int[] {android.R.id.text1});
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spnCity.setAdapter(adapter);
// set the data adapter for the country spinner
spnCountry = (Spinner) findViewById(R.id.ProviderSpinner);
SimpleCursorAdapter scaCountries = new SimpleCursorAdapter(this,
R.layout.simple_spinner_item,
mDbHelper.getCountries(),
new String[] { KEY_COUNTRY },
new int[] {android.R.id.text1});
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spnCountry.setAdapter(scaCountries);
They both display the correct data, but the first has radio buttons and the second doesn't. Any ideas why?
(R.layout.simple_spinner_item is the same as android.R.layout.simple_spinner_item, except it has android:textColor="@color/black"
added.)
In second spinner I think you have made a mistake Write
So your code will be