``` @BindingAdapter("android:languageColor") fun T...
# android
a
Copy code
@BindingAdapter("android:languageColor")
fun TextView.languageColor(color: String?) {
Usage
Copy code
android:languageColor="@{repo.primaryLanguage.color}"
I’ve verified that • TextView is the correct class (not appcompat) • Input is nullable (also tried
Any?
) And I’ve tried the label as
languageColor
. The IDE correctly autosuggests the name, but I’m getting the error:
Copy code
****/ data binding error ****msg:Cannot find the setter for attribute 'android:languageColor' with parameter type java.lang.String on android.widget.TextView.
Edit: Also just checked and it works fine with java
d
You can't put that in android namespaces.
g
You can, but usually it is confusing, better to omit namespace and use app or any own namespace (we use bind for custom bindings or methods, not related on view static attributes)
a
The examples actually used the android namespace. I ended up removing namespaces in declaration and used
app:
within the xml. Problem was with missing
kapt