HDL Home App 第二版本 旧平台金堂用 正在使用
黄学彪
2020-11-19 9ef48d7b2da7c408b53f73be0f6eef3cbac1c84a
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameListControl.cs
@@ -7,7 +7,7 @@
    /// <summary>
    /// 做成一个列表型的FrameLayout(它与VerticalListControl同一性质,但是它是FrameLayout,它会改变高度)
    /// </summary>
    public class FrameListControl : FrameLayout
    public class FrameListControl : FrameLayoutBase
    {
        /// <summary>
        /// 行之间的间距
@@ -32,10 +32,10 @@
            if (view is FrameRowControl || view is RowLayoutControl)
            {
                //FrameRowLayout控件的时候,直接扩大它的高度
                var tempView = this.GetChildren(this.ChildrenCount - 1);
                if (tempView != null)
                var intBottom = this.GetLocationMostLastViewBottom();
                if (intBottom != -1)
                {
                    view.Y = tempView.Bottom;
                    view.Y = intBottom;
                }
                base.AddChidren(view);
                if (rowSpace > 0)
@@ -46,10 +46,10 @@
            else
            {
                //非FrameRowLayout控件的时候,计算的是坐标
                var tempView = this.GetChildren(this.ChildrenCount - 1);
                if (tempView != null)
                var intBottom = this.GetLocationMostLastViewBottom();
                if (intBottom != -1)
                {
                    view.Y = tempView.Bottom + rowSpace;
                    view.Y = intBottom + rowSpace;
                }
                base.AddChidren(view);
            }
@@ -76,5 +76,24 @@
                this.Height = bottomHeight + bottomSpace;
            }
        }
        /// <summary>
        /// 获取坐标底部最下面的那个控件的底部坐标
        /// </summary>
        /// <returns></returns>
        private int GetLocationMostLastViewBottom()
        {
            int bottomHeight = -1;
            for (int i = 0; i < this.ChildrenCount; i++)
            {
                var child = this.GetChildren(i);
                if (child.Bottom > bottomHeight)
                {
                    bottomHeight = child.Bottom;
                }
            }
            return bottomHeight;
        }
    }
}