Change colour of small triangle on spinner in android

The best and easiest solution:

spinner.getBackground().setColorFilter(getResources().getColor(R.color.red), PorterDuff.Mode.SRC_ATOP);

Other solution (Thanks to Simon) if you don’t want change all Spinners:

Drawable spinnerDrawable = spinner.getBackground().getConstantState().newDrawable();

spinnerDrawable.setColorFilter(getResources().getColor(R.color.red), PorterDuff.Mode.SRC_ATOP);

if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
    spinner.setBackground(spinnerDrawable);
}else{
    spinner.setBackgroundDrawable(spinnerDrawable);
}

Leave a Comment