<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<variable name="user"
type="com.daimler.user.persistence.User"/>
<variable name="callback"
type="com.daimler.user.ui.UserClickCallback"/>
</data>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:paddingBottom="@dimen/row_padding"
android:paddingLeft="@dimen/activity_margin"
android:paddingRight="@dimen/activity_margin"
android:paddingTop="@dimen/row_padding"
android:onClick="@{() -> callback.onUserClick(user)}">
public class UserClickCallback {
public void onUserClick(User v) {
}
}
I wrote code like this, it looks okay but it shows error:
Error:(36, 28) Cannot find the setter for attribute 'android:onClick' with parameter type lambda on android.widget.RelativeLayout.
Anybody help ?
Change this line . Hope this Help.
android:onClick="@{() -> callback.onUserClick(user)}">
To
android:onClick="@{(view) -> callback.onUserClick(user)}">
I had the same problem.
I deleted the ".gradle
" folder and clicked "Rebuild Project
".
It worked for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With