gxc
2019-10-29 ed2f4a97aa48cdb4a013d2a389877f52eb3eccdf
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/ListViewLayoutControls/VerticalListControl.cs
@@ -19,10 +19,6 @@
        /// 最大高度
        /// </summary>
        private int maxHeight = -1;
        /// <summary>
        /// 一个没什么用的东西
        /// </summary>
        private FrameLayout frameBackTemp = null;
        #endregion
@@ -82,32 +78,24 @@
        /// <param name="addSpace">当真实高度超过原有高度时,是否添加空白</param>
        public void AdjustRealHeight(int bottomSpace, bool addSpace = true)
        {
            int count = frameBackTemp == null ? this.ChildrenCount : this.ChildrenCount - 1;
            if (count <= 0)
            if (this.ChildrenCount == 0)
            {
                frameBackTemp?.RemoveFromParent();
                frameBackTemp = null;
                //还原为最大高度
                this.Height = maxHeight;
                return;
            }
            //调整列表控件的高度
            var realHeight = count * this.GetChildren(0).Height + bottomSpace;
            var realHeight = this.ChildrenCount * this.GetChildren(0).Height + bottomSpace;
            if (realHeight < this.Height)
            {
                frameBackTemp?.RemoveFromParent();
                frameBackTemp = null;
                //缩小控件高度
                this.Height = realHeight;
            }
            else if (addSpace == true && bottomSpace > 0 && realHeight > this.maxHeight)
            {
                frameBackTemp?.RemoveFromParent();
                frameBackTemp = new FrameLayout();
                frameBackTemp.Height = bottomSpace;
                this.AddChidren(frameBackTemp);
                var frameBack = new FrameLayout();
                frameBack.Height = bottomSpace;
                this.AddChidren(frameBack);
            }
        }