HarmonyOS 鸿蒙Next 按视频学习animateTo+.onAreaChange开发点击图片下滑全屏展示没效果

HarmonyOS 鸿蒙Next 按视频学习animateTo+.onAreaChange开发点击图片下滑全屏展示没效果

 private imgHeight: number = 250
private isShow: boolean = false;
private windowHeight: number = 0
private isAlp:number = 0.5
build() {
Column(){
// KnowledgeMapContent()
Image($r(‘app.media.enablement_pic3’))
.backgroundColor(rgba(255,205,255,${this.isAlp}))
.width(‘100%’)
.height(this.imgHeight)
.objectFit(ImageFit.Contain)
.borderRadius(16)
// .geometryTransition(‘1’)
// .animation({duration:1000,curve:Curve.EaseOut})
.onClick(()=>{
this.isShow = !this.isShow
animateTo({duration:1000,curve:Curve.EaseOut},()=>{
if(this.isShow){
this.imgHeight = this.windowHeight
this.isAlp = 1
}else{
this.imgHeight = 250
this.isAlp = 0.5
}
})

})
}.width(“100%”).alignItems(HorizontalAlign.Center).justifyContent(FlexAlign.Center)
.onAreaChange((oldValue: Area, newValue: Area)=>{
this.windowHeight = typeof newValue.height ===‘number’?newValue.height:this.windowHeight
})
}

求解答


更多关于HarmonyOS 鸿蒙Next 按视频学习animateTo+.onAreaChange开发点击图片下滑全屏展示没效果的实战教程也可以访问 https://www.itying.com/category-93-b0.html

3 回复
【点击图片下滑全屏展示】效果是啥 不太理解

更多关于HarmonyOS 鸿蒙Next 按视频学习animateTo+.onAreaChange开发点击图片下滑全屏展示没效果的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html


你是参考哪个链接的视频学习的?

针对您提到的HarmonyOS 鸿蒙Next在按视频学习animateTo+.onAreaChange开发时,点击图片下滑全屏展示没有效果的问题,这通常是由于多种因素导致的。以下是一些可能的原因及排查方向:

  1. 代码逻辑检查:确保在onClick事件中,animateTo动画执行前后,isShow、imgHeight和isAlp等变量的值正确切换,并且这些变量的变化能正确影响UI展示。
  2. 全屏设置:检查是否已在onWindowStageCreate方法中正确调用了全屏设置函数,如setWindowLayoutFullScreen(true)。
  3. 布局约束:确认是否设置了影响全屏展示的布局约束,如maxHeight、maxWidth或clip属性。
  4. 父容器属性:确保父容器的布局属性没有限制子组件的扩展能力,如alignItems或justifyContent属性。

如果以上排查均未能解决问题,请考虑查阅最新的API文档或联系官网客服以获取进一步帮助。官网客服地址是:https://www.itying.com/category-93-b0.html

回到顶部