You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 1, 2024. It is now read-only.
A CollectionView using a GridItemsLayout with a Span that is not a whole factor of the collection view's width, and has a HorizontalItemSpacing of 0 will still have a gap.
Steps to Reproduce
Create a CollectionView with a GridItemsLayout with a Span of 3, HoriztonalItemSpacing of 0, and a width that is not a multiple of three (e.g full width of an iPod Touch 7th gen).
Make the CollectionView transparent and give the cells a non-transparent background color.
Make the content behind theCollectionView a different color to the cells.
Expected Behavior
None of the content behind the CollectionView is visible.
Actual Behavior
There is gaps between the cells in which the background content is visible.
I looked into this, and it seems to be a know issue. It's even in the comments of the GridViewLayout (see comment here)
I tried to apply a fix, with rounding and suck but didn't work. It's a tough one to solve I guess. One of the elements needs to be a bit bigger.
A workaround (if the design lets you) can be to give the CollectionView a margin of for example 1 (for example 320 - 2 (both sides 1) divided by 3 is 106 which makes an even number.
I'm porting some functionality already implemented natively in Xamarin.iOS. When I asked the people who implemented the original solution how they dealt with this, they said they just put an opaque box behind the collectionview and adjusted its constraints.
It seems this is just an issue without how UICollectionViewFlowLayout works (i.e., it is designed such that you size the cells and it fits what it can whereas the GridItemLayout assumes you tell it what should fit and it determines the size).
Fixing it completely may require creating a custom UICollectionViewLayout.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Description
A
CollectionView
using aGridItemsLayout
with aSpan
that is not a whole factor of the collection view's width, and has aHorizontalItemSpacing
of0
will still have a gap.Steps to Reproduce
CollectionView
with aGridItemsLayout
with aSpan
of 3,HoriztonalItemSpacing
of 0, and a width that is not a multiple of three (e.g full width of an iPod Touch 7th gen).CollectionView
transparent and give the cells a non-transparent background color.CollectionView
a different color to the cells.Expected Behavior
None of the content behind the
CollectionView
is visible.Actual Behavior
There is gaps between the cells in which the background content is visible.
Basic Information
Screenshots
Reproduction Link
https://github.com/GalaxiaGuy/xf-bugs/tree/bug/grid-spacing-gap
The text was updated successfully, but these errors were encountered: