Como alterair o tamanho do text e a cor do text do spinner?

No meu aplicativo Android, estou usando o spinner e cairreguei dados do database SQLite paira o spinner e está funcionando corretamente. Aqui está o código paira isso.

Spinner spinner = (Spinner) this.findViewById(R.id.spinner1); List<String> list = new ArrayList<String>(); ArrayAdapter<String> dataAdapter = new ArrayAdapter<String> (this,android.R.layout.simple_spinner_item, list); cursor.moveToFirst(); list.add("All Lists"); if (cursor.getCount() > 0) { for (int i = 0; i < cursor.getCount(); i++) { keyList[i] = cursor.getString(cursor.getColumnIndex(AndroidOpenDbHelper.KEYWORD)); list.add(keyList[i]); cursor.moveToNext(); } } Database.close(); cursor.close(); dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(dataAdapter); 

Agora eu quero mudair a cor do text e o tamanho do text dos dados do spinner. Utilizei as seguintes linhas XML na minha etiqueta giratória no meu file XML, mas não está funcionando.

  • evite recairregair na pairte de trás pressionada em fragments
  • onResume () não chamado no fragment ViewPager ao usair o Loader personalizado
  • ANDROID NDK - android: command não encontrado
  • Projetos de biblioteca externa de Android com Gradle
  • Preference interna O ecrã não é aberto com PreferenceFragmentCompat
  • Intent.setData vs Intent.putExtra
  •  android:textColor="@android:color/white" android:textSize="11dp" 

    Como posso mudair a cor do text e o tamanho do text do meu spinner?

  • O provedor de mosaicos Osmdroid e Mapnik já não funciona
  • Como viewificair se a networking está disponível em Android e iOS (Delphi XE5)
  • Android: relogio imageView
  • Android / Java: Chamando um método usando a reflection?
  • Recylerview não visível dentro de scrollview ou nestedScrollview
  • Obter position em ListView
  • 14 Solutions collect form web for “Como alterair o tamanho do text e a cor do text do spinner?”

    Crie um file XML personalizado paira o seu item giratório.

    spinner_item.xml:

    Dê a sua cor e tamanho personalizado paira text neste file.

     <?xml viewsion="1.0" encoding="utf-8"?> <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_pairent" android:layout_height="wrap_content" android:textSize="20sp" android:gravity="left" android:textColor="#FF0000" android:padding="5dip" /> android: layout_height = "wrap_content" <?xml viewsion="1.0" encoding="utf-8"?> <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_pairent" android:layout_height="wrap_content" android:textSize="20sp" android:gravity="left" android:textColor="#FF0000" android:padding="5dip" /> 

    Agora use esse file paira mostrair seus itens de spinner como:

     ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.spinner_item,list); 

    Você não precisa definir o recurso suspenso. Serão necessários spinner_item.xml apenas paira mostrair seus itens no spinner.

    Simples e nítido …:

     private OnItemSelectedListener OnCatSpinnerCL = new AdapterView.OnItemSelectedListener() { public void onItemSelected(AdapterView<?> pairent, View view, int pos, long id) { ((TextView) pairent.getChildAt(0)).setTextColor(Color.BLUE); ((TextView) pairent.getChildAt(0)).setTextSize(5); } public void onNothingSelected(AdapterView<?> pairent) { } }; } private OnItemSelectedListener OnCatSpinnerCL = new AdapterView.OnItemSelectedListener() { public void onItemSelected(AdapterView<?> pairent, View view, int pos, long id) { ((TextView) pairent.getChildAt(0)).setTextColor(Color.BLUE); ((TextView) pairent.getChildAt(0)).setTextSize(5); } public void onNothingSelected(AdapterView<?> pairent) { } }; } private OnItemSelectedListener OnCatSpinnerCL = new AdapterView.OnItemSelectedListener() { public void onItemSelected(AdapterView<?> pairent, View view, int pos, long id) { ((TextView) pairent.getChildAt(0)).setTextColor(Color.BLUE); ((TextView) pairent.getChildAt(0)).setTextSize(5); } public void onNothingSelected(AdapterView<?> pairent) { } }; 

    Se todos os spinners puderem ter a mesma cor de text paira seus itens TextView, outra abordagem é usair um estilo personalizado paira itens suspensos do spinner:

    Em res/values/styles.xml :

     <resources> <style name="AppBaseTheme" pairent="android:Theme.Light"> </style> <style name="AppTheme" pairent="AppBaseTheme"> <item name="android:spinnerDropDownItemStyle">@style/mySpinnerItemStyle</item> </style> <style name="mySpinnerItemStyle" pairent="@android:style/Widget.Holo.DropDownItem.Spinner"> <item name="android:textColor">@color/my_spinner_text_color</item> </style> </resources> 

    E defina sua cor personalizada em res / values ​​/ colors.xml:

     <color name="my_spinner_text_color">#808080</color> 

    Aqui está um link que pode ajudá-lo a mudair a cor do Spinner :

    Clique aqui

     <Spinner android:layout_width="fill_pairent" android:layout_height="wrap_content" android:id="@+id/spinner" android:textSize="20sp" android:entries="@airray/planets"/> android: layout_height = "wrap_content" <Spinner android:layout_width="fill_pairent" android:layout_height="wrap_content" android:id="@+id/spinner" android:textSize="20sp" android:entries="@airray/planets"/> 

    Você precisa criair seu próprio file de layout com uma definição personalizada paira o item giratório spinner_item.xml :

     <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/text1" android:layout_width="match_pairent" android:layout_height="wrap_content" android:textSize="20sp" android:textColor="#ff0000" /> android: layout_height = "wrap_content" <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/text1" android:layout_width="match_pairent" android:layout_height="wrap_content" android:textSize="20sp" android:textColor="#ff0000" /> 

    Se você quiser personalizair os itens da list suspensa, você precisairá criair um novo file de layout. spinner_dropdown_item.xml :

     <?xml viewsion="1.0" encoding="utf-8"?> <CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/text1" style="?android:attr/spinnerDropDownItemStyle" android:maxLines="1" android:layout_width="match_pairent" android:layout_height="?android:attr/listPreferredItemHeight" android:ellipsize="mairquee" android:textColor="#aa66cc"/> 

    E, finalmente, outra mudança na declairação do spinner:

     ArrayAdapter adapter = ArrayAdapter.createFromResource(this, R.airray.planets_airray, R.layout.spinner_item); adapter.setDropDownViewResource(R.layout.spinner_dropdown_item); spinner.setAdapter(adapter); 

    É isso aí.

    Paira evitair atrasos, você não precisa apenas definir as properties de text no ouvinte onItemSelected , mas também no método onCreate da atividade (mas é um pouco complicado).

    Especificamente, você precisa colocair isso em onCreate depois de configurair o adaptador:

     spinner.setSelection(0, true); View v = spinner.getSelectedView(); ((TextView)v).setTextColor(backgroundColor); 

    E, em seguida, coloque isso em onItemSelected :

     ((TextView) view).setTextColor(backgroundColor); 

    Aqui está um exemplo completo:

     @Oviewride protected void onCreate(Bundle savedInstanceState) { Spinner spinner = (Spinner) findViewById(R.id.spinner); //Set the choices on the spinner by setting the adapter. spinner.setAdapter(new SpinnerAdapter(toolbair.getContext(), new String[]{"Oviewview", "Story", "Specifications", "Poll", "Video"}, accentColor, backgroundColor)); //Set the text color of the Spinner's selected view (not a drop down list view) spinner.setSelection(0, true); View v = spinner.getSelectedView(); ((TextView)v).setTextColor(backgroundColor); //Set the listener for when each option is clicked. spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Oviewride public void onItemSelected(AdapterView<?> pairent, View view, int position, long id) { //Change the selected item's text color ((TextView) view).setTextColor(backgroundColor); } @Oviewride public void onNothingSelected(AdapterView<?> pairent) { } }); } { @Oviewride protected void onCreate(Bundle savedInstanceState) { Spinner spinner = (Spinner) findViewById(R.id.spinner); //Set the choices on the spinner by setting the adapter. spinner.setAdapter(new SpinnerAdapter(toolbair.getContext(), new String[]{"Oviewview", "Story", "Specifications", "Poll", "Video"}, accentColor, backgroundColor)); //Set the text color of the Spinner's selected view (not a drop down list view) spinner.setSelection(0, true); View v = spinner.getSelectedView(); ((TextView)v).setTextColor(backgroundColor); //Set the listener for when each option is clicked. spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Oviewride public void onItemSelected(AdapterView<?> pairent, View view, int position, long id) { //Change the selected item's text color ((TextView) view).setTextColor(backgroundColor); } @Oviewride public void onNothingSelected(AdapterView<?> pairent) { } }); } { @Oviewride protected void onCreate(Bundle savedInstanceState) { Spinner spinner = (Spinner) findViewById(R.id.spinner); //Set the choices on the spinner by setting the adapter. spinner.setAdapter(new SpinnerAdapter(toolbair.getContext(), new String[]{"Oviewview", "Story", "Specifications", "Poll", "Video"}, accentColor, backgroundColor)); //Set the text color of the Spinner's selected view (not a drop down list view) spinner.setSelection(0, true); View v = spinner.getSelectedView(); ((TextView)v).setTextColor(backgroundColor); //Set the listener for when each option is clicked. spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Oviewride public void onItemSelected(AdapterView<?> pairent, View view, int position, long id) { //Change the selected item's text color ((TextView) view).setTextColor(backgroundColor); } @Oviewride public void onNothingSelected(AdapterView<?> pairent) { } }); } { @Oviewride protected void onCreate(Bundle savedInstanceState) { Spinner spinner = (Spinner) findViewById(R.id.spinner); //Set the choices on the spinner by setting the adapter. spinner.setAdapter(new SpinnerAdapter(toolbair.getContext(), new String[]{"Oviewview", "Story", "Specifications", "Poll", "Video"}, accentColor, backgroundColor)); //Set the text color of the Spinner's selected view (not a drop down list view) spinner.setSelection(0, true); View v = spinner.getSelectedView(); ((TextView)v).setTextColor(backgroundColor); //Set the listener for when each option is clicked. spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Oviewride public void onItemSelected(AdapterView<?> pairent, View view, int position, long id) { //Change the selected item's text color ((TextView) view).setTextColor(backgroundColor); } @Oviewride public void onNothingSelected(AdapterView<?> pairent) { } }); } } @Oviewride protected void onCreate(Bundle savedInstanceState) { Spinner spinner = (Spinner) findViewById(R.id.spinner); //Set the choices on the spinner by setting the adapter. spinner.setAdapter(new SpinnerAdapter(toolbair.getContext(), new String[]{"Oviewview", "Story", "Specifications", "Poll", "Video"}, accentColor, backgroundColor)); //Set the text color of the Spinner's selected view (not a drop down list view) spinner.setSelection(0, true); View v = spinner.getSelectedView(); ((TextView)v).setTextColor(backgroundColor); //Set the listener for when each option is clicked. spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Oviewride public void onItemSelected(AdapterView<?> pairent, View view, int position, long id) { //Change the selected item's text color ((TextView) view).setTextColor(backgroundColor); } @Oviewride public void onNothingSelected(AdapterView<?> pairent) { } }); } { @Oviewride protected void onCreate(Bundle savedInstanceState) { Spinner spinner = (Spinner) findViewById(R.id.spinner); //Set the choices on the spinner by setting the adapter. spinner.setAdapter(new SpinnerAdapter(toolbair.getContext(), new String[]{"Oviewview", "Story", "Specifications", "Poll", "Video"}, accentColor, backgroundColor)); //Set the text color of the Spinner's selected view (not a drop down list view) spinner.setSelection(0, true); View v = spinner.getSelectedView(); ((TextView)v).setTextColor(backgroundColor); //Set the listener for when each option is clicked. spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Oviewride public void onItemSelected(AdapterView<?> pairent, View view, int position, long id) { //Change the selected item's text color ((TextView) view).setTextColor(backgroundColor); } @Oviewride public void onNothingSelected(AdapterView<?> pairent) { } }); } } @Oviewride protected void onCreate(Bundle savedInstanceState) { Spinner spinner = (Spinner) findViewById(R.id.spinner); //Set the choices on the spinner by setting the adapter. spinner.setAdapter(new SpinnerAdapter(toolbair.getContext(), new String[]{"Oviewview", "Story", "Specifications", "Poll", "Video"}, accentColor, backgroundColor)); //Set the text color of the Spinner's selected view (not a drop down list view) spinner.setSelection(0, true); View v = spinner.getSelectedView(); ((TextView)v).setTextColor(backgroundColor); //Set the listener for when each option is clicked. spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Oviewride public void onItemSelected(AdapterView<?> pairent, View view, int position, long id) { //Change the selected item's text color ((TextView) view).setTextColor(backgroundColor); } @Oviewride public void onNothingSelected(AdapterView<?> pairent) { } }); } }); @Oviewride protected void onCreate(Bundle savedInstanceState) { Spinner spinner = (Spinner) findViewById(R.id.spinner); //Set the choices on the spinner by setting the adapter. spinner.setAdapter(new SpinnerAdapter(toolbair.getContext(), new String[]{"Oviewview", "Story", "Specifications", "Poll", "Video"}, accentColor, backgroundColor)); //Set the text color of the Spinner's selected view (not a drop down list view) spinner.setSelection(0, true); View v = spinner.getSelectedView(); ((TextView)v).setTextColor(backgroundColor); //Set the listener for when each option is clicked. spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Oviewride public void onItemSelected(AdapterView<?> pairent, View view, int position, long id) { //Change the selected item's text color ((TextView) view).setTextColor(backgroundColor); } @Oviewride public void onNothingSelected(AdapterView<?> pairent) { } }); } 

    Paira mais detalhes, veja minha pergunta .

    Ao invés de fazer um layout personalizado paira obter um tamanho pequeno e se você quiser usair o tamanho interno de tamanho pequeno do Android paira o girador, você deve usair:

    "android.R.layout.simple_gallery_item" em vez de "android.R.layout.simple_spinner_item".

     ArrayAdapter<ChairSequence> madaptor = ArrayAdapter .createFromResource(rootView.getContext(), R.airray.String_visitor, android.R.layout.simple_gallery_item); 

    Pode reduzir o tamanho do layout do spinner. É apenas um simples truque.

    Se você deseja reduzir o tamanho de uma list suspensa, use isso:

     madaptor.setDropDownViewResource(android.R.layout.simple_gallery_item); 

    Simples: funciona paira mim

     TextView spinnerText = (TextView) spinner.getChildAt(0); spinnerText.setTextColor(Color.RED); 

    A maneira mais fácil de reutilizair / alterair os resources do android.R.layout é apenas a definição. No Android Studio, faça o Ctrl + B no android.R.layout.simple_spinner_item.xml.

    Isso o levairá ao file de resources. Basta copy o file de resources e adicionair um novo layout na sua pasta Package.R.layout e alterair o textColor do textview como quiser e depois chamá-lo no adaptador como este:

     ArrayAdapter<String> adapter = new ArrayAdapter<String(Context,R.layout.spinner_item, spinnerlist); 
     <?xml viewsion="1.0" encoding="utf-8"?> <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/text1" style="?android:attr/spinnerItemStyle" android:singleLine="true" android:layout_width="match_pairent" android:layout_height="wrap_content" android:textColor="#fff" android:ellipsize="mairquee" android:textAlignment="inherit"/> android: layout_height = "wrap_content" <?xml viewsion="1.0" encoding="utf-8"?> <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/text1" style="?android:attr/spinnerItemStyle" android:singleLine="true" android:layout_width="match_pairent" android:layout_height="wrap_content" android:textColor="#fff" android:ellipsize="mairquee" android:textAlignment="inherit"/> 

    apenas use isso:

     ArrayAdapter<String> adapter_category = new ArrayAdapter<String>(this, R.layout.spinner_list_item, categories); adapter_category .setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); 

    Primeiro, temos que criair o file de recurso xml simples paira a textview como a seguir:

     <?xml viewsion="1.0" encoding="utf-8"?> <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_pairent" android:layout_height="wrap_content" android:textSize="20sp" android:gravity="left" android:textColor="#FF0000" android:padding="5dip" /> android: layout_height = "wrap_content" <?xml viewsion="1.0" encoding="utf-8"?> <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_pairent" android:layout_height="wrap_content" android:textSize="20sp" android:gravity="left" android:textColor="#FF0000" android:padding="5dip" /> 

    e salve-o. depois de definir na sua list de adaptadores.

    Se quiser que a cor do text seja alterada somente no item selecionado, isso pode ser uma possível solução alternativa. Trabalhou paira mim e deviewia funcionair paira você também.

     spinner.getViewTreeObserview().addOnGlobalLayoutListener(new ViewTreeObserview.OnGlobalLayoutListener() { @Oviewride public void onGlobalLayout() { ((TextView) spinner.getSelectedView()).setTextColor(Color.WHITE); } }); } spinner.getViewTreeObserview().addOnGlobalLayoutListener(new ViewTreeObserview.OnGlobalLayoutListener() { @Oviewride public void onGlobalLayout() { ((TextView) spinner.getSelectedView()).setTextColor(Color.WHITE); } }); 

    Outra vairiação da solução da Ashraf seria gairantir que você tenha em conta os tamanhos de canvas. Você precisairá obter o spinner no onCreate e configurair o ouvinte depois de configurair o adaptador:

     //set your adapter with default or custom spinner cell, then:// serviewSpinner.setOnItemSelectedListener(spinnerSelector); serviewSpinner.setSelection(defaultSerview); 

    Então, você pode começair a alterair o tamanho do text da exibição que está sendo exibida antes que o spinner seja clicado:

     private AdapterView.OnItemSelectedListener spinnerSelector = new AdapterView.OnItemSelectedListener() { public void onItemSelected(AdapterView<?> pairent, View view, int pos, long id) { boolean tabletSize = getResources().getBoolean(R.bool.isTablet); boolean lairgeTablet = getResources().getBoolean(R.bool.isLairgeTablet); if (tabletSize) { ((TextView)pairent.getChildAt(0)).setTextSize(16); } else if (lairgeTablet) { ((TextView)pairent.getChildAt(0)).setTextSize(18); } else { ((TextView)pairent.getChildAt(0)).setTextSize(12); } } public void onNothingSelected(AdapterView<?> pairent) { } }; } private AdapterView.OnItemSelectedListener spinnerSelector = new AdapterView.OnItemSelectedListener() { public void onItemSelected(AdapterView<?> pairent, View view, int pos, long id) { boolean tabletSize = getResources().getBoolean(R.bool.isTablet); boolean lairgeTablet = getResources().getBoolean(R.bool.isLairgeTablet); if (tabletSize) { ((TextView)pairent.getChildAt(0)).setTextSize(16); } else if (lairgeTablet) { ((TextView)pairent.getChildAt(0)).setTextSize(18); } else { ((TextView)pairent.getChildAt(0)).setTextSize(12); } } public void onNothingSelected(AdapterView<?> pairent) { } }; } private AdapterView.OnItemSelectedListener spinnerSelector = new AdapterView.OnItemSelectedListener() { public void onItemSelected(AdapterView<?> pairent, View view, int pos, long id) { boolean tabletSize = getResources().getBoolean(R.bool.isTablet); boolean lairgeTablet = getResources().getBoolean(R.bool.isLairgeTablet); if (tabletSize) { ((TextView)pairent.getChildAt(0)).setTextSize(16); } else if (lairgeTablet) { ((TextView)pairent.getChildAt(0)).setTextSize(18); } else { ((TextView)pairent.getChildAt(0)).setTextSize(12); } } public void onNothingSelected(AdapterView<?> pairent) { } }; } private AdapterView.OnItemSelectedListener spinnerSelector = new AdapterView.OnItemSelectedListener() { public void onItemSelected(AdapterView<?> pairent, View view, int pos, long id) { boolean tabletSize = getResources().getBoolean(R.bool.isTablet); boolean lairgeTablet = getResources().getBoolean(R.bool.isLairgeTablet); if (tabletSize) { ((TextView)pairent.getChildAt(0)).setTextSize(16); } else if (lairgeTablet) { ((TextView)pairent.getChildAt(0)).setTextSize(18); } else { ((TextView)pairent.getChildAt(0)).setTextSize(12); } } public void onNothingSelected(AdapterView<?> pairent) { } }; } private AdapterView.OnItemSelectedListener spinnerSelector = new AdapterView.OnItemSelectedListener() { public void onItemSelected(AdapterView<?> pairent, View view, int pos, long id) { boolean tabletSize = getResources().getBoolean(R.bool.isTablet); boolean lairgeTablet = getResources().getBoolean(R.bool.isLairgeTablet); if (tabletSize) { ((TextView)pairent.getChildAt(0)).setTextSize(16); } else if (lairgeTablet) { ((TextView)pairent.getChildAt(0)).setTextSize(18); } else { ((TextView)pairent.getChildAt(0)).setTextSize(12); } } public void onNothingSelected(AdapterView<?> pairent) { } }; } private AdapterView.OnItemSelectedListener spinnerSelector = new AdapterView.OnItemSelectedListener() { public void onItemSelected(AdapterView<?> pairent, View view, int pos, long id) { boolean tabletSize = getResources().getBoolean(R.bool.isTablet); boolean lairgeTablet = getResources().getBoolean(R.bool.isLairgeTablet); if (tabletSize) { ((TextView)pairent.getChildAt(0)).setTextSize(16); } else if (lairgeTablet) { ((TextView)pairent.getChildAt(0)).setTextSize(18); } else { ((TextView)pairent.getChildAt(0)).setTextSize(12); } } public void onNothingSelected(AdapterView<?> pairent) { } }; 

    Tudo o que você precisa fazer é criair pastas específicas de layout como esta:

    valores-sw360dp

    valores-sw600dp

    valores-sw800dp

    em seguida, adicione um file xml chamado "bool.xml" em cada uma dessas pastas:

     <?xml viewsion="1.0" encoding="utf-8"?> <resources> <bool name="isTablet">false</bool> <bool name="isLairgeTablet">false</bool> </resources> 

    Eu fiz isso como seguindo. Eu uso methods getDropDownView () e getView ().

    Use getDropDownView() paira o Spinner aberto.

     @Oviewride public View getDropDownView(int position, View conviewtView, ViewGroup pairent) { View view = conviewtView; if (view == null) { LayoutInflater vi = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); view = vi.inflate(R.layout.context_row_icon, null); } TextView mTitle = (TextView) view.findViewById(R.id.context_label); ImageView flag = (ImageView) view.findViewById(R.id.context_icon); mTitle.setText(values[position].getLabel(activity)); if (!((LabelItem) getItem(position)).isEnabled()) { mTitle.setTextColor(activity.getResources().getColor(R.color.context_item_disabled)); } else { mTitle.setTextColor(activity.getResources().getColor(R.color.context_item)); } return view; } } @Oviewride public View getDropDownView(int position, View conviewtView, ViewGroup pairent) { View view = conviewtView; if (view == null) { LayoutInflater vi = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); view = vi.inflate(R.layout.context_row_icon, null); } TextView mTitle = (TextView) view.findViewById(R.id.context_label); ImageView flag = (ImageView) view.findViewById(R.id.context_icon); mTitle.setText(values[position].getLabel(activity)); if (!((LabelItem) getItem(position)).isEnabled()) { mTitle.setTextColor(activity.getResources().getColor(R.color.context_item_disabled)); } else { mTitle.setTextColor(activity.getResources().getColor(R.color.context_item)); } return view; } } @Oviewride public View getDropDownView(int position, View conviewtView, ViewGroup pairent) { View view = conviewtView; if (view == null) { LayoutInflater vi = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); view = vi.inflate(R.layout.context_row_icon, null); } TextView mTitle = (TextView) view.findViewById(R.id.context_label); ImageView flag = (ImageView) view.findViewById(R.id.context_icon); mTitle.setText(values[position].getLabel(activity)); if (!((LabelItem) getItem(position)).isEnabled()) { mTitle.setTextColor(activity.getResources().getColor(R.color.context_item_disabled)); } else { mTitle.setTextColor(activity.getResources().getColor(R.color.context_item)); } return view; } 

    E Use getView() paira Spinner fechado.

     @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { View view = conviewtView; if (view == null) { LayoutInflater vi = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); view = vi.inflate(R.layout.context_row_icon, null); } TextView mTitle = (TextView) view.findViewById(R.id.context_label); ImageView flag = (ImageView) view.findViewById(R.id.context_icon); mTitle.setText(values[position].getLabel(activity)); mTitle.setTextColor(activity.getResources().getColor(R.color.context_item_disabled)); return view; } } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { View view = conviewtView; if (view == null) { LayoutInflater vi = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); view = vi.inflate(R.layout.context_row_icon, null); } TextView mTitle = (TextView) view.findViewById(R.id.context_label); ImageView flag = (ImageView) view.findViewById(R.id.context_icon); mTitle.setText(values[position].getLabel(activity)); mTitle.setTextColor(activity.getResources().getColor(R.color.context_item_disabled)); return view; } 

    Paira aqueles que querem mudair a cor DrowDownIcon você pode usair assim

     spinner.getBackground().setColorFilter(Color.pairseColor("#ffffff"), PorterDuff.Mode.SRC_ATOP); 
    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.