解决时间格式设置页面息屏后滑动不能退出问题 3095/3 3095/head 3099/target/1
authorluozheng <1732036298@qq.com>
Fri, 16 Jan 2026 07:34:54 +0000 (15:34 +0800)
committerluozheng <1732036298@qq.com>
Fri, 16 Jan 2026 07:34:54 +0000 (15:34 +0800)
code/sdk/application/wearable/fd272/nativeapp/nativeui/set_time_format/include/SetTimeFormatView.h
code/sdk/application/wearable/fd272/nativeapp/nativeui/set_time_format/src/SetTimeFormatView.cpp

index 16f094d..904b1f8 100644 (file)
 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) {