material-components / material-components/material-components-android
[Carousel] Built-in way to set space between carousel items
@hunterstich arbeitet bereits daran.
Seit 14.12.2023.
- Vorherrschende Sprache
- Java
- Sterne
- 17.4k
- Forks
- 3.2k
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
Is your feature request related to a problem? Please describe.
The documented way of doing this is setting horizontal margins on the MaskableFrameLayout wrapping the carousel item. This however results in an issue where the left and right edges of the carousel (the way the user sees them) will constantly change as you scroll the carousel. For example, if the carousel recycler view has 16dp margins on the left and right, and the individual items have 4dp margins on left and right for 8dp of total space between, then as you scroll the carousel the actual visible space between the edge of the recycler view and the item will go back and forth between 16dp and 20dp (16+4), this issue becomes more obvious if you set larger margins on the item, for example 8dp on both sides.
Setting the margin only on one side of the item doesn't work because then the item will get slightly cut off on the opposite side of recycler view (see image, the right-most item is getting cut off)
Using the ItemDecoration API for this purpose also results in items getting cut off at the edges, and the decoration itself doesn't seem to play well with the carousel layout manager because the space between is not consistent (see image, left edge is getting cut off and the two spaces are different)
Describe the solution you'd like
An out of the box solution for setting space between items in a carousel that does not produce any of the issues described above
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Bewertung
Dieses Issue wurde noch nicht bewertet.