From 1e2a84b13d71a2a38cfbb8c453fbad1034411ad3 Mon Sep 17 00:00:00 2001 From: ywcoder <1104410818@qq.com> Date: Mon, 23 Jun 2025 09:47:36 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=96=B0=E5=A2=9EFAQ:Surface=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E4=B8=8B=E7=9A=84XComponent=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=9C=A8=E8=AE=BE=E7=BD=AERenderFit=E5=90=8E=E5=A6=82=E6=9E=9C?= =?UTF-8?q?=E5=87=BA=E7=8E=B0=E6=98=BE=E7=A4=BA=E5=BC=82=E5=B8=B8=EF=BC=8C?= =?UTF-8?q?=E8=AF=A5=E5=A6=82=E4=BD=95=E8=B0=83=E6=95=B4=E4=BB=A5=E8=8E=B7?= =?UTF-8?q?=E5=BE=97=E6=AD=A3=E7=A1=AE=E7=9A=84=E6=98=BE=E7=A4=BA=E6=95=88?= =?UTF-8?q?=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ets/pages/XComponentSurfaceRenderFit.ets | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 ArkUI/entry/src/main/ets/pages/XComponentSurfaceRenderFit.ets diff --git a/ArkUI/entry/src/main/ets/pages/XComponentSurfaceRenderFit.ets b/ArkUI/entry/src/main/ets/pages/XComponentSurfaceRenderFit.ets new file mode 100644 index 0000000..71f4ad9 --- /dev/null +++ b/ArkUI/entry/src/main/ets/pages/XComponentSurfaceRenderFit.ets @@ -0,0 +1,42 @@ +/* +* Copyright (c) 2024 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* FAQ:Surface模式下的XComponent组件在设置RenderFit后如果出现显示异常,该如何调整以获得正确的显示效果 +*/ +// [Start XComponent_Surface_RenderFit] +@Entry +@Component +struct XComponentSurfaceRenderFit { + @state xc_width: number = 500; + @state xc_height: number = 700; + myXComponentController: XComponentController = new XComponentController(); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Start }) { + XComponent({ + id: 'myXComponent_RenderFitSurface', // 当id的字符串中包含"RenderFitSurface"时,可以使RenderFit显示正确。 + type: XComponentType.SURFACE, + controller: this.myXComponentController + }) + .width(this.xc_width) + .height(this.xc_height) + .renderFit(RenderFit.CENTER) + } + .width('100%') + } +} + +// [End XComponent_Surface_RenderFit] \ No newline at end of file -- Gitee From dc9571b3a64b3be2e8e18c9f2e4baf330235016d Mon Sep 17 00:00:00 2001 From: ywcoder <1104410818@qq.com> Date: Mon, 23 Jun 2025 09:56:28 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ArkUI/entry/src/main/ets/pages/XComponentSurfaceRenderFit.ets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ArkUI/entry/src/main/ets/pages/XComponentSurfaceRenderFit.ets b/ArkUI/entry/src/main/ets/pages/XComponentSurfaceRenderFit.ets index 71f4ad9..3ecc76c 100644 --- a/ArkUI/entry/src/main/ets/pages/XComponentSurfaceRenderFit.ets +++ b/ArkUI/entry/src/main/ets/pages/XComponentSurfaceRenderFit.ets @@ -20,8 +20,8 @@ @Entry @Component struct XComponentSurfaceRenderFit { - @state xc_width: number = 500; - @state xc_height: number = 700; + @State xc_width: number = 500; + @State xc_height: number = 700; myXComponentController: XComponentController = new XComponentController(); build() { -- Gitee From 96481f72734b8f600308c9787904d26d5772f9e6 Mon Sep 17 00:00:00 2001 From: ywcoder <1104410818@qq.com> Date: Mon, 23 Jun 2025 10:10:07 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=96=B0=E5=A2=9EFAQ:=E5=A6=82=E4=BD=95?= =?UTF-8?q?=E8=A7=A3=E5=86=B3=E7=BB=84=E4=BB=B6=E6=B6=88=E5=A4=B1=E5=8A=A8?= =?UTF-8?q?=E7=94=BB=E5=81=8F=E7=A7=BB=E9=97=AA=E7=83=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DisappearanceAnimationOffsetFlicker.ets | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 ArkUI/entry/src/main/ets/pages/DisappearanceAnimationOffsetFlicker.ets diff --git a/ArkUI/entry/src/main/ets/pages/DisappearanceAnimationOffsetFlicker.ets b/ArkUI/entry/src/main/ets/pages/DisappearanceAnimationOffsetFlicker.ets new file mode 100644 index 0000000..039d4a3 --- /dev/null +++ b/ArkUI/entry/src/main/ets/pages/DisappearanceAnimationOffsetFlicker.ets @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2024 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* FAQ:如何解决组件消失动画偏移闪烁? +*/ + +// [Start DisappearanceAnimationOffsetFlicker] +@Entry +@ComponentV2 +struct DisappearanceAnimationOffsetFlicker { + @Local isShow: boolean = true; + + build() { + Stack() { + Stack() { + if (this.isShow) { + Row() + .width(100) + .height(100) + .backgroundColor(Color.Red) + .transition(TransitionEffect.OPACITY.animation({ duration: 150 })) + } + } + .width('100%') + .height('100%') + .onClick(() => { + this.isShow = !this.isShow + }) + } + } +} + +// [End DisappearanceAnimationOffsetFlicker] \ No newline at end of file -- Gitee