From 06495feac6090974cc882f1a50d6bfc8a3e74013 Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Fri, 16 Jan 2026 15:34:54 +0800 Subject: [PATCH] =?utf8?q?=E8=A7=A3=E5=86=B3=E6=97=B6=E9=97=B4=E6=A0=BC?= =?utf8?q?=E5=BC=8F=E8=AE=BE=E7=BD=AE=E9=A1=B5=E9=9D=A2=E6=81=AF=E5=B1=8F?= =?utf8?q?=E5=90=8E=E6=BB=91=E5=8A=A8=E4=B8=8D=E8=83=BD=E9=80=80=E5=87=BA?= =?utf8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../include/SetTimeFormatView.h | 1 + .../set_time_format/src/SetTimeFormatView.cpp | 32 +++++++++++-------- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/set_time_format/include/SetTimeFormatView.h b/code/sdk/application/wearable/fd272/nativeapp/nativeui/set_time_format/include/SetTimeFormatView.h index 7c6cf2887..a77e789c1 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/set_time_format/include/SetTimeFormatView.h +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/set_time_format/include/SetTimeFormatView.h @@ -28,6 +28,7 @@ public: void OnClick(UIView &view); private: + UIViewGroup group_; UILabelExt labelTitle_; UILabelExt labelFormat24H_; UIToggleButton btnFormat24H_; diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/set_time_format/src/SetTimeFormatView.cpp b/code/sdk/application/wearable/fd272/nativeapp/nativeui/set_time_format/src/SetTimeFormatView.cpp index 16f094dd9..904b1f81a 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/set_time_format/src/SetTimeFormatView.cpp +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/set_time_format/src/SetTimeFormatView.cpp @@ -17,7 +17,10 @@ namespace OHOS { SetTimeFormatView::SetTimeFormatView() {} -SetTimeFormatView::~SetTimeFormatView() {} +SetTimeFormatView::~SetTimeFormatView() +{ + group_.RemoveAll(); +} void SetTimeFormatView::OnStart() { @@ -25,21 +28,22 @@ void SetTimeFormatView::OnStart() { { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HeartResultView::InitHeartView fail"); } - - GetRootContainer()->SetDraggable(true); - GetRootContainer()->SetPosition(0, 0, 466, 466); - GetRootContainer()->SetOnDragListener(presenter_); - - GetRootContainer()->SetTouchable(true); } -bool SetTimeFormatView::SetTimeFormatInit() { +bool SetTimeFormatView::SetTimeFormatInit() +{ + group_.SetPosition(0, 0, 466, 466); + group_.SetStyle(STYLE_BACKGROUND_OPA, 0); + group_.SetTouchable(true); + group_.SetDraggable(true); + group_.SetOnDragListener(presenter_); + AddViewToRootContainer(&group_); Format24H_Image_.SetPosition(43, 120, 380, 100); Format24H_Image_.SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919); Format24H_Image_.SetStyle(STYLE_BACKGROUND_OPA, 0xff); Format24H_Image_.SetStyle(STYLE_BORDER_RADIUS, 100); - AddViewToRootContainer(&Format24H_Image_); + group_.Add(&Format24H_Image_); labelTitle_.SetPosition(83, 50, 300, 60); labelTitle_.SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); @@ -47,7 +51,7 @@ bool SetTimeFormatView::SetTimeFormatInit() { labelTitle_.SetTextId(STR_TIME_SET); // TODO:多国语言 labelTitle_.SetLineBreakMode(UILabel::LINE_BREAK_ELLIPSIS); // 居中 labelTitle_.SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - AddViewToRootContainer(&labelTitle_); + group_.Add(&labelTitle_); labelFormat24H_.SetPosition(90, 153, 200, 60); labelFormat24H_.SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); @@ -55,17 +59,19 @@ bool SetTimeFormatView::SetTimeFormatInit() { labelFormat24H_.SetTextId(STR_FORMAT); // TODO:多国语言 labelFormat24H_.SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION); labelFormat24H_.SetRollSpeed(23); - AddViewToRootContainer(&labelFormat24H_); + group_.Add(&labelFormat24H_); + + btnFormat24H_.SetPosition(298, 145, 100, 50); btnFormat24H_.SetImages(PNG_TOGGLEBUTTON_ON_IMAGE, PNG_TOGGLEBUTTON_OFF_IMAGE); - AddViewToRootContainer(&btnFormat24H_); + group_.Add(&btnFormat24H_); labelNote_.SetPosition(53, 240, 360, 100); labelNote_.SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20); labelNote_.SetTextId(STR_FORMAT_NOTE); - AddViewToRootContainer(&labelNote_); + group_.Add(&labelNote_); const TimeFormat style = SetTimeFormatModel::GetInstance().GetTimeStyle(); if (style == TimeFormat::TIME_FORMAT_24H) { -- 2.17.1