提交 21cc6e34 编写于 作者: limuyang2's avatar limuyang2

add `getViewByPosition()`

上级 ce25e78f
......@@ -690,6 +690,18 @@ abstract class BaseQuickAdapter<T, VH : BaseViewHolder>
}
}
/**
* get the specific view by position,e.g. getViewByPosition(2, R.id.textView)
*
* bind [RecyclerView.setAdapter] before use!
*/
fun getViewByPosition(position: Int, @IdRes viewId: Int): View? {
val recyclerView = weakRecyclerView.get() ?: return null
val viewHolder = recyclerView.findViewHolderForLayoutPosition(position) as BaseViewHolder?
?: return null
return viewHolder.getViewOrNull(viewId)
}
/********************************************************************************************/
/********************************* HeaderView Method ****************************************/
/********************************************************************************************/
......@@ -791,7 +803,6 @@ abstract class BaseQuickAdapter<T, VH : BaseViewHolder>
/**
* 获取头布局
* @return LinearLayout?
*/
val headerLayout: LinearLayout?
get() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册