[안드로이드] Databinding - Attach Listener in .xml file

Attach Listener in .xml file

Goal :

<androidx.recyclerview.widget.RecyclerView
    		...
            app:onScrollListner="@{viewModel.onScrollListenerForCardRecyclerView}"/>

write code in any class e.g. MyViewModel.class for attach attribute app:onScrollListener in xml.

@BindingAdapter("onScrollListener")
public static void setOnScrollListener(RecyclerView view, RecyclerView.OnScrollListener listener){
    view.addOnScrollListener(listener);
}