How can I change the colour of small triangle at the bottom right corner of spinner like shown in the image? It is showing default grey colour right now. like this
Spinners provide a quick way to select one value from a set. In the default state, a spinner shows its currently selected value. Touching the spinner displays a dropdown menu with all other available values, from which the user can select a new one.
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); }
From Lollipop on, you can set the background tint on xml,
android:backgroundTint="@color/my_color"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With