-
-
Notifications
You must be signed in to change notification settings - Fork 165
Open
Description
如题
版本是:v1.6.1-x
如下,按照源码注释加了必要的逻辑,但不起作用。(Demo 中是可以保留状态的,好奇用的哪个版本,或者我哪里写错了?)
data class CommentWrapBean(var comment: String?) : ExpandableStatusFix {
private var status: StatusType? = null
override fun getStatus(): StatusType? {
return status
}
override fun setStatus(status: StatusType) {
this.status = status
}
}
val commentView = holder.getView<ExpandableTextView>(R.id.etv_comment)
val commentWrapBean = CommentWrapBean(item.content)
commentView.bind(commentWrapBean)
commentView.setContent(commentWrapBean.comment)
源码注释:
/**
* @date: on 2018/9/20
* @author: cretin
* @email: [email protected]
* @desc: 如果你需要在滑动的时候保持之前的展开或者收起的状态
* 则
* 一、实现 ExpandableStatusFix
* 二、在你的model中定义一个
* private StatusType status;
* 三、实现对应的方法,将你刚刚定义的status返回,
* 四、并在给ExpandableTextView设置内容之前,调用bind方法
*/
Metadata
Metadata
Assignees
Labels
No labels