From 9ef48d7b2da7c408b53f73be0f6eef3cbac1c84a Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期四, 19 十一月 2020 10:23:45 +0800 Subject: [PATCH] Evoyo.Home1.1.0120111601_Release --- ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameListControl.cs | 55 ++++++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 48 insertions(+), 7 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameListControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameListControl.cs index a32a785..636f8a8 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameListControl.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameListControl.cs @@ -7,7 +7,7 @@ /// <summary> /// 鍋氭垚涓�涓垪琛ㄥ瀷鐨凢rameLayout(瀹冧笌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,13 +46,54 @@ else { //闈濬rameRowLayout鎺т欢鐨勬椂鍊�,璁$畻鐨勬槸鍧愭爣 - 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); } } + + /// <summary> + /// 璋冩暣鐪熷疄楂樺害 + /// </summary> + /// <param name="bottomSpace">搴曢儴楂樺害(闈炵湡瀹炲��)</param> + public void AdjustRealHeight(int bottomSpace = 0) + { + int bottomHeight = -1; + + for (int i = 0; i < this.ChildrenCount; i++) + { + var child = this.GetChildren(i); + if (child.Bottom > bottomHeight) + { + bottomHeight = child.Bottom; + } + } + if (bottomHeight != -1) + { + 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; + } } } -- Gitblit v1.8.0