如何将Ability的UI界面设置成透明?

如何将Ability的UI界面设置成透明

阅读 482
1 个回答

将最上层容器组件背景色设置为透明,然后通过设置XComponent组件的opacity属性值为0.01来实现。

示例代码

build() {  
  Stack() {  
    XComponent({  
    id: 'componentId', 
    type: 'surface',  
    })  
    .width('100%')  
    .height('100%') 
    .opacity(0.01)  
    // 页面内容 
   } 
   .width('100%') 
   .height('100%') 
   .backgroundColor('rgba(255,255,255, 0)') 
 }
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进