切换界面按钮设置透明度为0,目的是解决长按切换表盘时主界面可见,原先是切换是表盘会黑
author罗正yun <1732036298@qq.com>
Fri, 19 Jan 2024 10:06:22 +0000 (18:06 +0800)
committer罗正yun <1732036298@qq.com>
Fri, 19 Jan 2024 10:06:22 +0000 (18:06 +0800)
code/sdk/application/wearable/nativeapp/nativeui/dial/src/Digital_clockView.cpp

index dd110ea..eaf01b4 100644 (file)
@@ -366,7 +366,7 @@ namespace OHOS
             timeLable->SetViewId("label1");              // Set style
             timeLable->SetStyle(STYLE_TEXT_FONT, digitsize);
 
-            // Set additional property
+           
             timeLable->SetText(stringtime.c_str());
             timeLable->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
             timeLable->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
@@ -425,7 +425,7 @@ namespace OHOS
         sweepClock1_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);
         sweepClock1_->SetStyle(STYLE_BACKGROUND_OPA, 0x00);
 
-        // Set additional property
+       
         sweepClock1_->SetWorkMode(UISweepClock::WorkMode::NORMAL);
         Image *sweepClock1HourImage = new Image();
         std::string HourImagePath = std::string(handspath) + "hour.bin";
@@ -552,7 +552,7 @@ namespace OHOS
         weekLable->SetViewId("label2"); // Set style
         weekLable->SetStyle(STYLE_TEXT_FONT, fontsize);
 
-        // Set additional property
+       
         cJSON *weekformat = cJSON_GetObjectItem(displayformat, "weekformat");
         std ::string weekStr;
         if (weekformat != nullptr && cJSON_IsArray(weekformat))
@@ -634,7 +634,7 @@ namespace OHOS
         batteryLable->SetViewId("label3"); // Set style
         batteryLable->SetStyle(STYLE_TEXT_FONT, fontsize);
 
-        // Set additional property
+       
         batteryLable->SetText((std::to_string(value) + "%").c_str());
         batteryLable->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
         batteryLable->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
@@ -662,17 +662,16 @@ namespace OHOS
         {
             changebutton = new UIButton();
         }
-        changebutton->SetPosition(0, 0);       // widget's left position and top position
-        changebutton->Resize(466, 466);        // widget's width and height
-        changebutton->SetViewId(CHANGEBUTTON); // Set style
+        changebutton->SetPosition(0, 0);      
+        changebutton->Resize(466, 466);        
+        changebutton->SetViewId(CHANGEBUTTON);
         changebutton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);
         changebutton->SetStyle(STYLE_BACKGROUND_OPA, 0x00);
+        changebutton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xffffffff, UIButton::PRESSED);
+        changebutton->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED);
+        changebutton->SetStyleForState(STYLE_BORDER_COLOR, 0xffffffff, UIButton::PRESSED);
+        changebutton->SetStyleForState(STYLE_BORDER_OPA, 0x00, UIButton::PRESSED);
         
-        // Set additional property
-        changebutton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff000000, UIButton::PRESSED);
-        changebutton->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);
-        
-        // Add the CallBack about events
         UIView::OnLongPressListener *buttonLongPress = static_cast<UIView::OnLongPressListener *>(MainPresenterSample::GetInstance());
         changebutton->SetOnLongPressListener(buttonLongPress);
         // Add to rootView