material-components / material-components/material-components-android

[MaterialDividerItemDecoration] Request: support GridLayoutManager too

Open
#3,079 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature request Widget: Divider
Dominant language
Java
Stars
17.4k
Forks
3.2k
PR merge metrics
No merged PRs in 30d

Description

**Is your feature request related to a problem? Please describe.**
Currently it supports only one orientation, but not both. This is what's in code:

MaterialDividerItemDecoration divider =
new MaterialDividerItemDecoration(getContext(), orientation);
recyclerView.addItemDecoration(divider);

Not only that, but I think it draws outside the boundary. If you can, you can compare what you make with this solution:
https://github.com/Fondesa/RecyclerViewDivider

**Describe the solution you'd like**
Be able to set the divider to be shown on all orientations of the layoutManager, so that it will work for a grid, too.
Maybe even make it as such by default, because on the other solution I've mentioned it doesn't require it at all.

**Describe alternatives you've considered**
As I wrote, this works better:
https://github.com/Fondesa/RecyclerViewDivider

The usage there is as such:

recyclerView.addDivider()

**Additional context**
Relevant part in the sample:
https://github.com/material-components/material-components-android/tree/master/catalog/java/io/material/catalog/divider

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the MaterialDividerItemDecoration usage in the catalog sample and compare its current behavior with the linked RecyclerViewDivider solution. Verify the change supports both orientations with GridLayoutManager and keeps dividers within the layout boundary.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.