我想添加onTouch以调整recyclerview高度,并使用onClick选择recyclelerview项目。但在reclerviewview的高度调整后,我无法使用onClick。为什么会这样?以及如何解决它?
这是我的示例代码:
val pageMonth = cal.get(Calendar.MONTH) -1
val adapter2 = CalendarCobaAdapter2(dayValue, pageMonth, false)
recyclerview.adapter = adapter2
recyclerview.setOnTouchListener { v, event ->
when(event!!.action){
MotionEvent.ACTION_MOVE -> {
Log.d("OntOUhc","ASD")
v!!.layoutParams.height = event.getY().toInt()
v.requestLayout()
}
}
true
}
adapter2.setClickListener(this)