title: How to display the spinner with transparent background for selected value in android?
body: <pre><code>package com.android.example;
  import android.app.Activity;
  import android.content.Context;
  import android.graphics.Color;
  import android.os.Bundle;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.AdapterView;
  import android.widget.ArrayAdapter;
  import android.widget.BaseAdapter;
  import android.widget.RelativeLayout;
  import android.widget.Spinner;
  import android.widget.TextView;
  import android.widget.Toast;
  import android.widget.AdapterView.OnItemSelectedListener;
  public class SpinnerActivity extends Activity implements OnItemSelectedListener {
  
      private ICSAdapter mAdapter;
      private String[] mNameList = {"one","two","three" };
      Context context=this;
      Spinner room_type;
  
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.spinner_activity_main);
          room_type = (Spinner) findViewById(R.id.ics_spinner);
  
          mAdapter = new ICSAdapter(context, mNameList);
           room_type.setAdapter(mAdapter);
           room_type.setOnItemSelectedListener(new OnItemSelectedListener() {
             @Override
                  public void onItemSelected(AdapterView&lt;?&gt; Adapter, View view,
                          int position, long id) {
                          room_type.setSelection(position);
                          View selectedText = (View) Adapter.getChildAt(position);
                          if (selectedText != null) {
                              RelativeLayout real = (RelativeLayout) selectedText.findViewById(R.id.real);
                              TextView selected = (TextView) selectedText.findViewById(R.id.name_view);
                              selected.setText(mNameList[position].toUpperCase());
                              ((View) selected.getParent()).setBackgroundColor(Color.TRANSPARENT);
  //                          real.setBackgroundColor(Color.TRANSPARENT);
  
                          }
                      }
                      @Override
                  public void onNothingSelected(AdapterView&lt;?&gt; Adapter) {
                      // TODO Auto-generated method stub
  
                  }
              });
  
      }
  
      public class ICSAdapter extends BaseAdapter {
  
          private LayoutInflater inflater;
          private Context context;
          String[] room_type;
  
          public ICSAdapter(Context context, String[] _accidentList) {
              this.room_type = _accidentList;
              this.context = context;
  
              inflater = (LayoutInflater) this.context
                      .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
          }
  
          @Override
          public int getCount() {
              return room_type.length;
          }
  
          @Override
          public Object getItem(int position) {
              return room_type[position];
          }
  
          @Override
          public long getItemId(int position) {
              return position;
          }
  
          @Override
          public View getView(final int position, View convertView, ViewGroup parent) {
              ViewHolder holder;
              convertView = inflater.inflate(R.layout.drop_down_view, null);
              holder = new ViewHolder();
              holder.spinnerText   = (TextView) convertView.findViewById(R.id.name_view);
              holder.spinnerText.setText(room_type[position]);
             return convertView;
          }
  
  
          public class ViewHolder {
              TextView spinnerText;
          }
  
      }
  
      @Override
      public void onItemSelected(AdapterView&lt;?&gt; arg0, View arg1, int arg2,
              long arg3) {
          // TODO Auto-generated method stub
  
      }
  
      @Override
      public void onNothingSelected(AdapterView&lt;?&gt; arg0) {
          // TODO Auto-generated method stub
  
      }
  }
  
  activity_main.xml
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent" 
      android:background="@drawable/bg"
      android:layout_gravity="center"
      &gt;
  
  &lt;Spinner
          android:id="@+id/ics_spinner"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:gravity="center"
          android:layout_centerHorizontal="true"
          android:layout_centerVertical="true"
          android:layout_alignParentTop="true"
          android:background="@drawable/text3"
         /&gt;
  
  &lt;/RelativeLayout&gt;
  
  dropdown.xml
  &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/real"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:background="#2D333C" &gt;
  
      &lt;TextView
          android:id="@+id/name_view"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_centerHorizontal="true"
          android:layout_centerVertical="true"
          android:layout_marginTop="5dp"
          android:gravity="center"
          android:text="324"
          android:textColor="@color/android:white"
          android:textSize="18sp" /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>Here i am using the default spinner with some background image. I have one issue, when i click the spinner,the dropdown list will display in white color background.But the orignal color background will not displayed(android:background="#2D333C")
  I am using the transparent color for backgound change.How to resolve this issue. I want to display the given background color,when i click the spinner in dropdown list.After i select the selected value,the background will transaparent.Can anyone help me to solve this issue?</p>