material-components / material-components/material-components-android
[Carousel] Built-in way to set space between carousel items
@hunterstich ci sta già lavorando.
Dal 14/12/2023.
- Lingua principale
- Java
- Stelle
- 17.4k
- Fork
- 3.2k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
**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
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Valutazione
Questa issue non è ancora stata valutata.