我在回收者视图中添加了一个分隔线
var itemDecorator =object: DividerItemDecoration(applicationContext, LinearLayoutManager.VERTICAL){
override fun getItemOffsets(
outRect: Rect,
view: View,
parent: RecyclerView,
state: RecyclerView.State
) {
var position = parent.getChildAdapterPosition(view);
outRect.setEmpty();
if (position == mylist.size - 1) {
super.getItemOffsets(outRect, view, parent, state);
// setDrawable(ContextCompat.getDrawable(applicationContext, R.drawable.finish_scrolling)!!);
}
}
}
itemDecorator.setDrawable(ContextCompat.getDrawable(applicationContext, R.drawable.selector2)!!);
rv!!.addItemDecoration(itemDecorator)
我想在最后一项之后显示图像,我将如何处理,或者还有其他方法可以这样做吗?