I\'m facing a problem with the new backward compatibility with VectorDrawables. In the Support Library 23.2 was a new feature for backward compatibility with Android VectorD
I suggest this workaround to make the color change based on state: Set a normal, white VectorDrawable, and have the tint have the color selector.
This was tested to work even on emulator with Android API 16, and it works even if you set "vectorDrawables.useSupportLibrary = true" in gradle, of course.
Example: first view is enabled, and the second is disabled:
MainActivity.kt
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
disabledSendMessageButton.isEnabled = false
}
}
res/layout/activity_main.xml
res/color/color_selector.xml
res/drawable/ic_baseline_send_24.xml