From 18b93d511dc764b469d7c4a7e755f7274f89cdb4 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期一, 27 四月 2020 17:55:14 +0800
Subject: [PATCH] 2020-4-27-1

---
 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/ListViewLayoutControls/VerticalFrameControl.cs |   53 +++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 45 insertions(+), 8 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/ListViewLayoutControls/VerticalFrameControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/ListViewLayoutControls/VerticalFrameControl.cs
index b35a549..8038b83 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/ListViewLayoutControls/VerticalFrameControl.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/ListViewLayoutControls/VerticalFrameControl.cs
@@ -5,7 +5,7 @@
 namespace Shared.Phone.UserCenter
 {
     /// <summary>
-    /// 鍋氭垚涓�涓噷闈㈠彧瑁匜rameLayout鐨勫垪琛ㄥ瀷鎺т欢(瀹冧笉浼氳皟鏁撮珮搴�)
+    /// 鍋氭垚涓�涓噷闈㈠彧瑁匜rameLayout鐨勫垪琛ㄥ瀷鎺т欢(瀹冧笉浼氳皟鏁撮珮搴�,鏈夋甯�)
     /// </summary>
     public class VerticalFrameControl : VerticalScrolViewLayout
     {
@@ -96,13 +96,14 @@
         /// <param name="buttomSpace">搴曢儴绌虹櫧闂磋窛(鐪熷疄鍊�)</param>
         public void AdjustChidrenFrameHeight(FrameLayout frame, int buttomSpace)
         {
-            var child = frame.GetChildren(frame.ChildrenCount - 1);
-            if (child != null)
+            //鑾峰彇鍧愭爣搴曢儴鏈�涓嬮潰鐨勯偅涓帶浠剁殑搴曢儴鍧愭爣
+            int value = this.GetLocationMostLastViewBottom(frame);
+            if (value != -1)
             {
                 //璋冩暣妗屽竷楂樺害
-                if (frame.Height < child.Bottom + buttomSpace)
+                if (frame.Height < value + buttomSpace)
                 {
-                    frame.Height = child.Bottom + buttomSpace;
+                    frame.Height = value + buttomSpace;
                 }
             }
         }
@@ -112,11 +113,12 @@
         /// </summary>
         public void AdjustTableHeight()
         {
-            var child = this.m_frameTable?.GetChildren(this.m_frameTable.ChildrenCount - 1);
-            if (child != null)
+            //鑾峰彇鍧愭爣搴曢儴鏈�涓嬮潰鐨勯偅涓帶浠剁殑搴曢儴鍧愭爣
+            int value = this.GetLocationMostLastViewBottom(this.m_frameTable);
+            if (value != -1)
             {
                 //璋冩暣妗屽竷楂樺害
-                this.m_frameTable.Height = child.Bottom;
+                this.m_frameTable.Height = value;
             }
         }
 
@@ -133,9 +135,44 @@
                 return;
             }
             //娣诲姞涓存椂鎺т欢,鐩磋嚦鍙互婊戝姩瓒呰繃搴曢儴鎸夐挳
+            int oldRowSpace = this.rowSpace;
+            this.rowSpace = 0;
             var frameBackTemp = new FrameLayout();
             frameBackTemp.Height = ControlCommonResourse.BodyFrameHeight - btnTemp.Yaxis + Application.GetRealHeight(23);
             this.AddChidrenFrame(frameBackTemp);
+            this.rowSpace = oldRowSpace;
+        }
+
+        /// <summary>
+        /// 杩樺師妗屽竷楂樺害
+        /// </summary>
+        public void RecoverTableHeight()
+        {
+            if (this.m_frameTable != null)
+            {
+                m_frameTable.Height = this.Height;
+            }
+        }
+
+        /// <summary>
+        /// 鑾峰彇鍧愭爣搴曢儴鏈�涓嬮潰鐨勯偅涓帶浠剁殑搴曢儴鍧愭爣
+        /// </summary>
+        /// <returns></returns>
+        private int GetLocationMostLastViewBottom(FrameLayout frame)
+        {
+            int bottomHeight = -1;
+
+            if (frame == null) { return bottomHeight; }
+           
+            for (int i = 0; i < frame.ChildrenCount; i++)
+            {
+                var child = frame.GetChildren(i);
+                if (child.Bottom > bottomHeight)
+                {
+                    bottomHeight = child.Bottom;
+                }
+            }
+            return bottomHeight;
         }
 
         #endregion

--
Gitblit v1.8.0