Does anyone know how to center a card inside an horizontal pager? It always put the card at the left of the horizontal pager. I tried using page size, content padding etc but with no luck, maybe I am missing something.
I achieve to see other cards setting page size at the same size of the card but is not centered horizontally
Sergio Moral
12/22/2023, 12:08 PM
I have checked official Android documentation and it says that adding content padding start and end at the same size, it centers the card horizontally but not my case
s
Stylianos Gakis
12/22/2023, 1:05 PM
What does your code look like?
a
andrew
12/22/2023, 3:22 PM
You also need to balance the card size alongside the gap padding
s
Sergio Moral
01/02/2024, 9:40 AM
Hi, I finally found the solution, it was my bad for different reasons.
First, it was about the Figma design, it wasn’t the right values and secondly, it was because I was setting the page size fixed, so that moved my page to the left side.
The solution was just adding the right horizontal padding values and not needing to specify the page size fixed to any value. With the right padding and the page size to fill it was enough to get the right solution.
Thanks and happy new year! 🎊