Hi, I googled a long time and still got no solution for my issue. I customized my spinner view and the spinners dropdown menu. Within the spinner itself I show a color representation and a simple text (I kicked some attributes to save space in this post):
spinner_color_item.xml > <?xml version="1.0" encoding="utf-8"?> > <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"> > <View android:id="@+id/vColorCode" /> > <TextView android:id="@+id/tvColorName" /> > </LinearLayout> > My dropdown menu (one item element in the menu) looks like this: <?xml version="1.0" encoding="utf-8"?> > <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"> > <View android:id="@+id/vColorCode" /> > <TextView android:id="@+id/tvColorName" /> > <RadioButton android:id="@+id/rbChooseColor" /> > </LinearLayout> > Everything looks fine, the spinner is shown as expected and the dropdown menu items look like I wanted. I am using a customized ArrayAdapter, for models that look like: public class ColorItem { > private String colorName; > private int colorValue; > private boolean selected; > public ColorItem() { > } > public ColorItem(String colorName, int colorValue) { > this.colorName = colorName; > this.colorValue = colorValue; > } > // some methods (getter and setter) > } > The code within my onCreate method looks like: spiColor = (Spinner) findViewById(R.id.spiGroupColor); SpinnerColorAdapter colorAdapter = new SpinnerColorAdapter(this, > android.R.layout.simple_spinner_item, prepareColorItems()); > spiColor.setAdapter(colorAdapter); > OnItemSelectedListener l = new OnItemSelectedListener() { > @Override > public void onItemSelected(AdapterView<?> arg0, View view, int > position, long id) { > // never called. Why?! > if (spinnerInitialized) { > } > spinnerInitialized = true; > } > @Override > public void onNothingSelected(AdapterView<?> arg0) { > } > }; > spiColor.setOnItemSelectedListener(l); > I overwrote the getDropDownView method of my custom adapter. The view is created successfully, how I defined in xml, but I want to close the dropdown menu after selected one item, so I want to close it with clicking the radiobutton of one item. Set the selection works very well, but I have to exit the menu pressing escape in my emulator. Hope someone can help, I need a way to close the dropdown menu programatically. Does anybody have the same problem? Thanks a lot! -Danny Schimke -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en