private void FitSize2(int position, bool scrollingLeft, int columnHeaderScrollPosition, int columnHeaderOffset,
                              int columnHeaderFirstItem)
        {
            int columnCacheWidth = mColumnHeaderLayoutManager.GetCacheWidth(position);

            Android.Views.View column = mColumnHeaderLayoutManager.FindViewByPosition(position);
            if (column != null)
            {
                // Loop for all rows which are visible.
                for (int j = FindFirstVisibleItemPosition(); j < FindLastVisibleItemPosition() + 1; j++)
                {
                    // Get CellRowRecyclerView
                    CellRecyclerView child = (CellRecyclerView)FindViewByPosition(j);
                    if (child != null)
                    {
                        ColumnLayoutManager childLayoutManager = (ColumnLayoutManager)child.GetLayoutManager();
                        // Checking Scroll position is necessary. Because, even if they have same width
                        // values, their scroll positions can be different.
                        if (!scrollingLeft && columnHeaderScrollPosition != child.GetScrolledX())
                        {
                            // Column Header RecyclerView has the right scroll position. So,
                            // considering it
                            childLayoutManager.ScrollToPositionWithOffset(columnHeaderFirstItem, columnHeaderOffset);
                        }

                        Fit2(position, j, columnCacheWidth, column, childLayoutManager);
                    }
                }
            }
        }
        private int Fit(int xPosition, int yPosition, int left, int right, int columnCachedWidth)
        {
            CellRecyclerView child = (CellRecyclerView)FindViewByPosition(yPosition);

            if (child != null)
            {
                ColumnLayoutManager childLayoutManager = (ColumnLayoutManager)child.GetLayoutManager();
                int cellCacheWidth      = GetCacheWidth(yPosition, xPosition);
                Android.Views.View cell = childLayoutManager.FindViewByPosition(xPosition);
                // Control whether the cell needs to be fitted by column header or not.
                if (cell != null)
                {
                    if (cellCacheWidth != columnCachedWidth || mNeedSetLeft)
                    {
                        // This is just for setting width value
                        if (cellCacheWidth != columnCachedWidth)
                        {
                            cellCacheWidth = columnCachedWidth;
                            TableViewUtils.SetWidth(cell, cellCacheWidth);
                            SetCacheWidth(yPosition, xPosition, cellCacheWidth);
                        }

                        // Even if the cached values are same, the left & right value wouldn't change.
                        // mNeedSetLeft & the below lines for it.
                        if (left != IgnoreLeft && cell.Left != left)
                        {
                            // Calculate scroll distance
                            int scrollX = Math.Max(cell.Left, left) - Math.Min(cell.Left, left);
                            // Update its left
                            cell.Left = left;
                            int offset = mHorizontalListener.GetScrollPositionOffset();
                            // It shouldn't be scroll horizontally and the problem is gotten just for
                            // first visible item.
                            if (offset > 0 && xPosition == childLayoutManager.FindFirstVisibleItemPosition() &&
                                mCellRecyclerView.ScrollState != RecyclerView.ScrollStateIdle)
                            {
                                int scrollPosition = mHorizontalListener.GetScrollPosition();
                                offset = mHorizontalListener.GetScrollPositionOffset() + scrollX;
                                // Update scroll position offset value
                                mHorizontalListener.SetScrollPositionOffset(offset);
                                // Scroll considering to the desired value.
                                childLayoutManager.ScrollToPositionWithOffset(scrollPosition, offset);
                            }
                        }

                        if (cell.Width != cellCacheWidth)
                        {
                            if (left != IgnoreLeft)
                            {
                                // TODO: + 1 is for decoration item. It should be gotten from a
                                // generic method  of layoutManager
                                // Set right
                                right      = cell.Left + cellCacheWidth + 1;
                                cell.Right = right;
                                childLayoutManager.LayoutDecoratedWithMargins(cell, cell.Left, cell.Top, cell.Right,
                                                                              cell.Bottom);
                            }

                            mNeedSetLeft = true;
                        }
                    }
                }
            }

            return(right);
        }