-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
子view的点击事件怎么设置,绑定的是bean,不是viewmodel? #15
Comments
没听太懂,是把Vm也传到xml里面吗?,但是有个问题,这个Vm没有具体某个itemview的dataBean,点击事件可能要判断数据, 我现在的做法,datas传dats,不知道可不可行,试下先 |
datas《bean》传datas《itemViewmodel》 |
vm 里有 data 的呀。所以xml里只用传入vm就行了。data 和 onItemClick 都在 vm 里了。 ListVM.kt open class ListVM<T>{
open var data = ObservableArrayList<T>()
open val onItemClick: OnItemClickListener<T>? = null
open val headerData: Any? = null
} g_two_way_list.xml <layout ...>
<data>
<variable name="listVM" type="com.fashare.databinding.TwoWayListVM"/>
</data>
<android.support.v7.widget.RecyclerView
...
bind:vm="@{listVM}"
bind:data="@{listVM.data}"/>
</layout> |
但是我看listener调用是设置给convertview的,我想给itemview里面的图片,按钮,之类的设置事件。 这个在这怎么应用? |
终于听懂你在说啥了。。这个目前还不支持,😂。支持的话也好弄,RecyclerViewAdapter.java里面setAdapter()那里暴露一个接口出来。 话说,这个项目还不是很完善,不要在自己项目里用。 |
😂没有,我自己搞搞demo的。 |
暂时没时间维护这个。随便一提的是,adapter 模块是基于鸿洋大大的 baseAdapter,我只针对 databinding 封装了一层。
|
The text was updated successfully, but these errors were encountered: