Workaround scrolling bug
authorLukasz Stanislawski <l.stanislaws@samsung.com>
Tue, 29 Dec 2020 17:35:37 +0000 (18:35 +0100)
committerPiotr Czaja <p.czaja@samsung.com>
Tue, 14 Sep 2021 11:01:34 +0000 (13:01 +0200)
It occured that setting LayoutManager properties of RecyclerView
in the constructor do not work properly.

Fitness/Controls/BindableRecyclerView.cs
Fitness/Views/MainView.xaml.cs

index 108ac71dc125b8c270cbc978ebdf8198050dfc49..cf9c422d1033588281f27a9b58010b81fa4fd6ea 100644 (file)
@@ -34,10 +34,8 @@ namespace Fitness.Controls
         private TapGestureDetector detector;
 
         public BindableRecyclerView()
-            : base(new RecycleAdapter(), new LinearRecycleLayoutManager())
+            : base()
         {
-            // TODO workaround orientation set bug
-            LayoutManager.LayoutOrientation = RecycleLayoutManager.Orientation.Horizontal;
             SelectionMode = RecyclerViewSelectionMode.None;
 
             ContentContainer.ChildAdded += ChildAddedCallback;
index aca450641cb3223903a7595cc875e833270341e8..fc8aa98516a044667346bff9f6f923b84f0d5b2c 100644 (file)
@@ -13,8 +13,13 @@ namespace Fitness.Views
 
             this.button1.ApplyStyle(Styles.Buttons.Inverse);
             this.button2.ApplyStyle(Styles.Buttons.Regular);
-            this.scroller.ScrollingDirection = ScrollableBase.Direction.Horizontal;
             this.scroller.SelectionMode = BindableRecyclerView.RecyclerViewSelectionMode.Single;
+
+            this.scroller.LayoutManager = new LinearRecycleLayoutManager()
+            {
+                LayoutOrientation = RecycleLayoutManager.Orientation.Horizontal,
+            };
+            this.scroller.ScrollingDirection = ScrollableBase.Direction.Horizontal;
         }
     }
 }