Skip to content
This repository has been archived by the owner on Jul 3, 2023. It is now read-only.

libon/BackgroundTintIssueApp

Repository files navigation

This project demonstrates an issue with Android Studio showing a warning about a databinding feature that works

Steps to reproduce:

  • Open the project in Android Studio

  • Open the file activity_main.xml

  • Expected behavior: No error appears

  • ⚠️ Actual behavior: An error appears about the android:backgroundTint attribute:

    Cannot find a setter for that accepts parameter type 'androidx.lifecycle.MutableLiveData<java.lang.Integer>'

  • Install the app to a device

  • Expected behavior: the button appears with the custom shape, tinted red

  • Actual behavior: it works as expected:

Note: In the generated databinding file, ./app/build/generated/source/kapt/debug/com/example/backgroundtintissueapp/databinding/ActivityMainBindingImpl.java, the code supports converting the LiveData's Int to a ColorStateList:

    this.mboundView1.setBackgroundTintList(androidx.databinding.adapters.Converters.convertColorToColorStateList(viewModelBackgroundColorLiveDataGetValue));

Releases

No releases published

Packages

No packages published

Languages