我有RecyclerView
StickyHeaderDecor
(内有Button
,ImageView
和TextView
。
如何在StickyHeader
?
library used is UltimateRecyclerView
。
这是我设置recyclerView
的代码:
StickyRecyclerHeadersDecoration headersDecoration =
new StickyRecyclerHeadersDecoration(adapter);
recyclerView.addItemDecoration(headersDecoration);
StickyRecyclerHeadersTouchListener headersTouchListener =
new StickyRecyclerHeadersTouchListener(recyclerView, headersDecoration);
headersTouchListener.setOnHeaderClickListener(new StickyRecyclerHeadersTouchListener.OnHeaderClickListener() {
@Override
public void onHeaderClick(View headerView, int position, long headerId) {
Log.d(TAG, "clicked view " + v.getId() + " position:" + position);
// my code here to handle click (*)
}
});
recyclerView.addOnItemTouchListener(headersTouchListener);
(*)我无法处理点击headerView
。
答案 0 :(得分:1)