From: 罗正yun <1732036298@qq.com> Date: Fri, 19 Jan 2024 10:06:22 +0000 (+0800) Subject: 切换界面按钮设置透明度为0,目的是解决长按切换表盘时主界面可见,原先是切换是表盘会黑 X-Git-Tag: release_V1.2.70_20241020_135402~1351^2~8^2 X-Git-Url: http://git.snicker.com.cn/Users/apple/Desktop/static/gitweb.css?a=commitdiff_plain;h=261f500f41a714dfd80d0e5428df0dd3755e3358;p=mirrors%2FFD230.git 切换界面按钮设置透明度为0,目的是解决长按切换表盘时主界面可见,原先是切换是表盘会黑 --- diff --git a/code/sdk/application/wearable/nativeapp/nativeui/dial/src/Digital_clockView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/dial/src/Digital_clockView.cpp index dd110ea84..eaf01b49e 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/dial/src/Digital_clockView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/dial/src/Digital_clockView.cpp @@ -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(MainPresenterSample::GetInstance()); changebutton->SetOnLongPressListener(buttonLongPress); // Add to rootView