#1095,解决日程,下滑后无法回到原位置bug
authorluozheng <1732036298@qq.com>
Thu, 31 Oct 2024 12:44:38 +0000 (20:44 +0800)
committerluozheng <1732036298@qq.com>
Thu, 31 Oct 2024 12:44:38 +0000 (20:44 +0800)
code/sdk/application/wearable/fd230app/nativeui/schedule/include/ScheduleListItem.h
code/sdk/application/wearable/fd230app/nativeui/schedule/src/ScheduleListAdapter.cpp
code/sdk/application/wearable/fd230app/nativeui/schedule/src/ScheduleListItem.cpp
code/sdk/application/wearable/fd230app/nativeui/schedule/src/ScheduleView.cpp

index 8050861..3a3c125 100644 (file)
@@ -30,6 +30,7 @@ namespace OHOS
         ~ScheduleListItem() override;
         void SetItemInfo(const ScheduleListItemInfo &itemInfo);
         void ResetItemStyle(const ScheduleListItemInfo &itemInfo);
+        void ResetHeight(bool val);
 
 
     private:
index 2b4477d..a67e6b4 100644 (file)
@@ -58,6 +58,10 @@ namespace OHOS
             item->SetItemInfo(node->data_);
             item->SetOnClickListener(itemClickListener_);
         }
+        if(nodeList_.Size() > 2 && index == nodeList_.Size() - 1)
+            item->ResetHeight(true);
+        else
+            item->ResetHeight(false);
 
         return item;
     }
index 1203291..aa3f8bf 100644 (file)
@@ -141,4 +141,17 @@ namespace OHOS
         }
     }
 
+    void ScheduleListItem::ResetHeight(bool val)
+    {
+        //防止list中元素超过3个后最后一个被遮住,且仅在最后一个元素设置其高度为160
+        if (val)
+        {
+            SetHeight(ITEM_HEIGHT + ITEM_GAP*3);
+        }
+        else
+        {
+            SetHeight(ITEM_HEIGHT + ITEM_GAP);
+        }
+    }
+
 }
index 213c886..67957cd 100644 (file)
@@ -344,7 +344,7 @@ namespace OHOS
             ScheduleList_->SetDragACCLevel(5); // 5: drag acceleration\r
             ScheduleList_->SetYScrollBarVisible(false);\r
 \r
-            ScheduleList_->SetScrollBlankSize(40);\r
+            // ScheduleList_->SetScrollBlankSize(40);\r
             ScheduleList_->SetReboundSize(30);\r
 \r
             ScheduleList_->SetRotateFactor(2); // 增加表冠控制\r