| 137 | |
| 138 | DividerItemDecoration groupDecorator = new DividerItemDecoration(getContext(), llm.getOrientation()) { |
| 139 | @Override |
| 140 | public void onDraw(@NonNull Canvas canvas, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) { |
| 141 | int count = parent.getChildCount(); |
| 142 | for (int i = 0; i < count; i++) { |
| 143 | View view = parent.getChildAt(i); |
| 144 | int pos = parent.getChildAdapterPosition(view); |
| 145 | |
| 146 | View header = getView(view, parent, pos); |
| 147 | if (header != null) { |
| 148 | canvas.save(); |
| 149 | canvas.translate(0, parent.getChildAt(i).getTop() - header.getMeasuredHeight()); |
| 150 | header.draw(canvas); |
| 151 | canvas.restore(); |
| 152 | } |
| 153 | } |
| 154 | } |
| 155 | |
| 156 | @Override |
| 157 | public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { |