Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Bug] CollectionView on Android does not layout new items properly #13054

Closed
EvanMulawski opened this issue Dec 4, 2020 · 3 comments · Fixed by #10624
Closed

[Bug] CollectionView on Android does not layout new items properly #13054

EvanMulawski opened this issue Dec 4, 2020 · 3 comments · Fixed by #10624

Comments

@EvanMulawski
Copy link

EvanMulawski commented Dec 4, 2020

Description

When adding an item to the CollectionView's ItemsSource (bound to an ObservableCollection), the CollectionView layout's ItemSpacing property is not respected (using LinearItemsLayout).

Steps to Reproduce

  1. Without clearing or resetting the ItemsSource, add a new item to the backing data source.
  2. On Android, observe that the new item does not respect the ItemSpacing set on the CollectionView's layout.
  3. Triggering a layout pass by, for example, changing tabs, will resolve this.

Expected Behavior

The new items should be spaced as existing items are.

Actual Behavior

On Android, the new items do not respect the layout's ItemSpacing property.

Basic Information

  • Version with issue: 4.8.0.1687
  • Last known good version:
  • Platform Target Frameworks:
    • iOS: 14.1 (for comparison, not affected)
    • Android: 9.0 (API 28), 10.0 (API 29)
    • UWP:
  • Android Support Library / AndroidX Version:
  • NuGet Packages:
  • Affected Devices: Android Emulator

Environment

Show/Hide
Microsoft Visual Studio Enterprise 2019
Version 16.8.2
VisualStudio.16.Release/16.8.2+30717.126
Microsoft .NET Framework
Version 4.8.03752

Installed Version: Enterprise

ADL Tools Service Provider   1.0
This package contains services used by Data Lake tools

ASA Service Provider   1.0

ASP.NET and Web Tools 2019   16.8.553.28003
ASP.NET and Web Tools 2019

ASP.NET Core Razor Language Services   16.1.0.2052803+84e121f1403378489b842e1797df2f3f5a49ac3c
Provides languages services for ASP.NET Core Razor.

ASP.NET Web Frameworks and Tools 2019   16.8.553.28003
For additional information, visit https://www.asp.net/

Azure App Service Tools v3.0.0   16.8.553.28003
Azure App Service Tools v3.0.0

Azure Data Lake Node   1.0
This package contains the Data Lake integration nodes for Server Explorer.

Azure Data Lake Tools for Visual Studio   2.6.1000.0
Microsoft Azure Data Lake Tools for Visual Studio

Azure Functions and Web Jobs Tools   16.8.553.28003
Azure Functions and Web Jobs Tools

Azure Stream Analytics Tools for Visual Studio   2.6.1000.0
Microsoft Azure Stream Analytics Tools for Visual Studio

C# Tools   3.8.0-5.20567.16+53c5d7d3cf13d88978744a32a27c5f8350a8400a
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools   1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Extensibility Message Bus   1.2.6 (master@34d6af2)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

Fabric.DiagnosticEvents   1.0
Fabric Diagnostic Events

GitHub.VisualStudio   2.11.106.19330
A Visual Studio Extension that brings the GitHub Flow into Visual Studio.

IntelliCode Extension   1.0
IntelliCode Visual Studio Extension Detailed Info

Microsoft Azure HDInsight Azure Node   2.6.1000.0
HDInsight Node under Azure Node

Microsoft Azure Hive Query Language Service   2.6.1000.0
Language service for Hive query

Microsoft Azure Service Fabric Tools for Visual Studio   16.0
Microsoft Azure Service Fabric Tools for Visual Studio

Microsoft Azure Stream Analytics Language Service   2.6.1000.0
Language service for Azure Stream Analytics

Microsoft Azure Stream Analytics Node   1.0
Azure Stream Analytics Node under Azure Node

Microsoft Azure Tools   2.9
Microsoft Azure Tools for Microsoft Visual Studio 2019 - v2.9.30924.1

Microsoft Continuous Delivery Tools for Visual Studio   0.4
Simplifying the configuration of Azure DevOps pipelines from within the Visual Studio IDE.

Microsoft JVM Debugger   1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft Library Manager   2.1.113+g422d40002e.RR
Install client-side libraries easily to any web project

Microsoft MI-Based Debugger   1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual Studio Tools for Containers   1.1
Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.

Mono Debugging for Visual Studio   16.8.43 (00471f8)
Support for debugging Mono processes with Visual Studio.

Node.js Tools   1.5.20902.1 Commit Hash:b474efcb6f92db52a8f8e2e6a8cb9648476885cc
Adds support for developing and debugging Node.js apps in Visual Studio

NuGet Package Manager   5.8.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

ProjectServicesPackage Extension   1.0
ProjectServicesPackage Visual Studio Extension Detailed Info

Redgate SQL Change Automation   4.3.20316.22971
Extend DevOps processes to your SQL Server databases and safely automate database deployments.

Visit https://www.red-gate.com/sca/productpage for more information.

Copyright (C) 2011 Red Gate Software Ltd. All rights reserved.

This software contains components from Component Owl.
SQL Server is a registered trademark of Microsoft Corporation.
Visual Studio is a registered trademark of Microsoft Corporation.

SQL Change Automation contains code from the following open source software:

NuGet https://www.nuget.org/
SQL LocalDB Wrapper https://github.com/martincostello/sqllocaldb
Autofac https://autofac.org/
Json.NET https://json.net/
SemVer https://github.com/maxhauser/semver
Serilog https://serilog.net/
StringTemplate https://github.com/antlr/stringtemplate4
Extended WPF Toolkit https://wpftoolkit.codeplex.com/
Code InfoBox VSX http://www.codeproject.com/Articles/55196/Code-InfoBox-Visual-Studio-Extension-VSX
OctoPack https://github.com/OctopusDeploy/OctoPack
SQLite https://sqlite.org/

This product contains icons from http://www.visualpharm.com distributed under a free backlink license.

For license details or other notices relating to the above software, please see NOTICE.TXT and EULA.rtf in the SQL Change Automation application folder.
    

Snapshot Debugging Extension   1.0
Snapshot Debugging Visual Studio Extension Detailed Info

SonarLint for Visual Studio   4.28.0.24595
SonarLint is an extension to your favorite IDE that provides on-the-fly feedback to developers on new bugs and quality issues injected into their code.

SQL Server Data Tools   16.0.62010.06180
Microsoft SQL Server Data Tools

ToolWindowHostedEditor   1.0
Hosting json editor into a tool window

TypeScript Tools   16.0.21016.2001
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools   3.8.0-5.20567.16+53c5d7d3cf13d88978744a32a27c5f8350a8400a
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools   16.8.0-beta.20507.4+da6be68280c89131cdba2045525b80890401defd
Microsoft Visual F# Tools

Visual Studio Code Debug Adapter Host Package   1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio Container Tools Extensions   1.0
View, manage, and diagnose containers within Visual Studio.

Visual Studio Tools for Containers   1.0
Visual Studio Tools for Containers

Visual Studio Tools for Kubernetes   1.0
Visual Studio Tools for Kubernetes

VisualStudio.DeviceLog   1.0
Information about my package

VisualStudio.Foo   1.0
Information about my package

VisualStudio.Mac   1.0
Mac Extension for Visual Studio

Xamarin   16.8.000.255 (d16-8@d002176)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer   16.8.0.507 (remotes/origin/d16-8@e87b24884)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates   16.8.112 (86385a3)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK   11.1.0.17 (d16-8/c0e2b8e)
Xamarin.Android Reference Assemblies and MSBuild support.
    Mono: be2226b
    Java.Interop: xamarin/java.interop/d16-8@79d9533
    ProGuard: Guardsquare/proguard/proguard6.2.2@ebe9000
    SQLite: xamarin/sqlite/3.32.1@1a3276b
    Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-8@2fb1cbc


Xamarin.iOS and Xamarin.Mac SDK   14.4.1.3 (e30c41de3)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

Screenshots

Before adding a new item:
image

After adding a new item:
image

Reproduction Link

https://github.com/EvanMulawski/XamarinFormsIssues/tree/master/XFIssues/XFIssues/XF13054

Workaround

@EvanMulawski EvanMulawski added s/unverified New report that has yet to be verified t/bug 🐛 labels Dec 4, 2020
@samhouts samhouts added this to New in Triage Dec 4, 2020
@EvanMulawski
Copy link
Author

Added repro

@EvanMulawski
Copy link
Author

Possibly fixed by #10624 ?

@PureWeen
Copy link
Contributor

PureWeen commented Dec 7, 2020

I pulled down the nuget for #10624 and it looks like it fixes it!

@PureWeen PureWeen moved this from New to Ready For Work in Triage Dec 7, 2020
@PureWeen PureWeen removed the s/unverified New report that has yet to be verified label Dec 7, 2020
@hartez hartez added this to Backlog in CollectionView via automation Dec 13, 2020
@hartez hartez removed this from Ready For Work in Triage Dec 13, 2020
@hartez hartez moved this from Backlog to In Review in CollectionView Dec 13, 2020
@hartez hartez added this to the 5.0.0 milestone Dec 13, 2020
CollectionView automation moved this from In Review to Done Dec 18, 2020
rmarinho added a commit that referenced this issue Dec 18, 2020
…#10624) fixes #9125 fixes #10585 fixes #13054 fixes #9681

* -fixed incorrect outRect values

* fixed unassigned offsets

* -fixed incorrect lastSpanIndex and outRect values

* -fixed itemdecorations stayed same when collection is updated

* Fix indexes in notifications

* Fix hang when inserting item in CarouselView

* Fix timing issue with Carousel current item when inserting

* Use GetSpanGroupIndex to determine first row/column

* Fix starting index for looped CarouselView

* Fix Carousel tests so they don't all fail when one fails;
Fix Carousel tests so they don't take 30 minutes to run;

* Fix index offset on looped Carousel;

Co-authored-by: E.Z. Hart <hartez@gmail.com>
Co-authored-by: Rui Marinho <me@ruimarinho.net>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Development

Successfully merging a pull request may close this issue.

3 participants