Android - Tinting RippleDrawables
Android starting from Lollipop provided ability to tint UI elements for better user feedback. Pressing and holding a button starts a tint animation which is stopped as soon as the user lets go of the button. This is done by handling the touch event and using appropriate drawable resources to redraw the button. Besides, the tint animation is pivoted at the touch coordinates known as a hot spot. Lollipop by default supports tint animations for all applications and the SDK offers API to customize the color. This would be needed for applications which have a custom color for the UI elements and the platform's tint color doesn't necessarily work with the app custom color. Besides, new versions of support library even offers compat versions to apply tint colors. DrawableCompat offers a setTintList API to apply tint colors based on various states of the drawable resource. This is usually applicable for stateful drawables ( Drawable.isStateful ). ...