コード例 #1
0
        public override void OnDraw(Canvas c, RecyclerView parent, RecyclerView.State state)
        {
            var left  = parent.Left;
            var right = parent.Right;

            var        childCount = parent.ChildCount;
            ViewHolder prevHolder = null;

            for (var i = 0; i < childCount; i++)
            {
                var child  = parent.GetChildAt(i);
                var holder = parent.GetChildViewHolder(child) as ViewHolder;

                if (prevHolder != null && prevHolder is IHeaderViewHolder && !_settingsView.ShowSectionTopBottomBorder ||
                    holder is IFooterViewHolder && !_settingsView.ShowSectionTopBottomBorder ||
                    holder is IFooterViewHolder && !holder.RowInfo.Section.Any() ||
                    holder is IHeaderViewHolder ||
                    !holder.RowInfo.Section.IsVisible)
                {
                    prevHolder = holder;
                    continue;
                }

                var bottom = child.Top;
                var top    = bottom - _drawable.IntrinsicHeight;
                _drawable.SetBounds(left, top, right, bottom);
                _drawable.Draw(c);

                prevHolder = holder;
            }
        }
        void BindCustomHeaderFooterView(ViewHolder holder, Xamarin.Forms.View formsView)
        {
            var nativeCell = holder.ItemView as HeaderFooterContainer;

            nativeCell.FormsCell = formsView;
        }