slidetoact
slidetoact copied to clipboard
SlideToActView app:slider_icon doesn't accept databinding
What kind of issue is this?
- [ ] This is a functional bug : I tried to use databinding in app:slider_icon but it shows this message
Cannot find a setter for <com.ncorti.slidetoact.SlideToActView app:slider_icon> that accepts parameter type 'android.graphics.drawable.Drawable' If a binding adapter provides the setter, check that the adapter is annotated correctly and that the parameter type matches.
Details
- Library Version : 0.9.0.
- Example Code :
<com.ncorti.slidetoact.SlideToActView android:layout_width="wrap_content" android:layout_height="wrap_content" app:outer_color="@color/azul_two" app:rotate_icon="false" app:slider_height="44dp" app:slider_icon="@{modelView.checkinType == true? @drawable/ic_check_in: @drawable/ic_check_out}" app:slider_icon_color="@color/black" />
Thanks for the report
Cannot find a setter for <com.ncorti.slidetoact.SlideToActView app:slider_icon> that accepts parameter type 'android.graphics.drawable.Drawable' If a binding adapter provides the setter, check that the adapter is annotated correctly and that the parameter type matches.
That's indeed true. The setter for slider_icon
is of type Int
and not Drawable
:
https://github.com/cortinico/slidetoact/blob/0e2ca7da2e115140747afe457bf78f65a6bb689d/slidetoact/src/main/java/com/ncorti/slidetoact/SlideToActView.kt#L151-L163
I'm unsure what would be the best approach to offer better support for Databinding here. Perhaps we need another setter of type Drawable
.
Happy to review a PR if someone has the time to look into this 👍
Thank you for your response, I'll try to look into this if I have some free time.