Can I get the view holder of item of edittext's text object reference?
My viewholder...
override fun bind(list: MutableList<Test>, position: Int) {
list.get(position).test.get(0).editable = binding.etTest.text //not reference
val testEdit = binding.root.findViewById(R.id.et_test) as EditText
list.get(position).test.get(0).editable = testEdit.text ////not reference
}
when text is changed, list.get(position).test.get(0).editable is not changed..
How can I do this?
答案 0 :(得分:0)
您需要澄清您的问题,但是我认为您想使用RecyclerView
。在这种情况下,您必须使用ViewHolder
模式。
ViewHolder
负责使您的视图膨胀,并保留对您的EditText
或视图中任何内容的引用。然后,在bind()
方法中,您可以填充那个/那个EditText
。