From: luozheng <1732036298@qq.com> Date: Thu, 31 Oct 2024 12:44:38 +0000 (+0800) Subject: #1095,解决日程,下滑后无法回到原位置bug X-Git-Tag: fd230_release_V1.3.102~29^2~95^2^2~3 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=b86084c672c0d4ae3b9aa34f8de198a3d23f64af;p=mirrors%2FFD230.git #1095,解决日程,下滑后无法回到原位置bug --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/schedule/include/ScheduleListItem.h b/code/sdk/application/wearable/fd230app/nativeui/schedule/include/ScheduleListItem.h index 80508611b..3a3c125fd 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/schedule/include/ScheduleListItem.h +++ b/code/sdk/application/wearable/fd230app/nativeui/schedule/include/ScheduleListItem.h @@ -30,6 +30,7 @@ namespace OHOS ~ScheduleListItem() override; void SetItemInfo(const ScheduleListItemInfo &itemInfo); void ResetItemStyle(const ScheduleListItemInfo &itemInfo); + void ResetHeight(bool val); private: diff --git a/code/sdk/application/wearable/fd230app/nativeui/schedule/src/ScheduleListAdapter.cpp b/code/sdk/application/wearable/fd230app/nativeui/schedule/src/ScheduleListAdapter.cpp index 2b4477dc9..a67e6b402 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/schedule/src/ScheduleListAdapter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/schedule/src/ScheduleListAdapter.cpp @@ -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; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/schedule/src/ScheduleListItem.cpp b/code/sdk/application/wearable/fd230app/nativeui/schedule/src/ScheduleListItem.cpp index 1203291e2..aa3f8bf2a 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/schedule/src/ScheduleListItem.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/schedule/src/ScheduleListItem.cpp @@ -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); + } + } + } diff --git a/code/sdk/application/wearable/fd230app/nativeui/schedule/src/ScheduleView.cpp b/code/sdk/application/wearable/fd230app/nativeui/schedule/src/ScheduleView.cpp index 213c886b4..67957cde4 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/schedule/src/ScheduleView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/schedule/src/ScheduleView.cpp @@ -344,7 +344,7 @@ namespace OHOS ScheduleList_->SetDragACCLevel(5); // 5: drag acceleration ScheduleList_->SetYScrollBarVisible(false); - ScheduleList_->SetScrollBlankSize(40); + // ScheduleList_->SetScrollBlankSize(40); ScheduleList_->SetReboundSize(30); ScheduleList_->SetRotateFactor(2); // 增加表冠控制