indira indira - 1 year ago 146
Android Question

Android spinner - expand list view

Could you please tell me how to do a spinner that look like a list item that can be expanded?

I need something like shown in the figure given.! While clicking the arrow image the spinner pops up and the text is hide.

enter image description here

I use the following code.

spin.setOnItemSelectedListener(new OnItemSelectedListener() {
public void onItemSelected(AdapterView parent, View view, int position, long id) {
// hide selection text
// if you want you can change background here
public void onNothingSelected(AdapterView parent) {



But then also there is flashing of text above the arrow background image for a second.

Any suggestion to avoid this?

Answer Source

try this

String[] androidBooks = 
    "Hello, Android - Ed Burnette",
    "Professional Android 2 App Dev - Reto Meier",
    "Unlocking Android - Frank Ableson",
    "Android App Development - Blake Meike",
    "Pro Android 2 - Dave MacLean",
    "Beginning Android 2 - Mark Murphy",
    "Android Programming Tutorials - Mark Murphy",
    "Android Wireless App Development - Lauren Darcey",
    "Pro Android Games - Vladimir Silva",

Spinner s=(Spinner)findViewById(;
ArrayAdapter<String> adapter=new ArrayAdapter<String>(this, android.R.layout.select_dialog_singlechoice,androidBooks);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download