https://kotlinlang.org logo
#android
Title
# android
a

Allan Wang

06/15/2019, 9:55 PM
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

dawidhyzy

06/16/2019, 6:19 AM
You can't put that in android namespaces.
g

gildor

06/16/2019, 1:42 PM
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

Allan Wang

06/16/2019, 10:10 PM
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
3 Views