直接上代码 。

       XComponent({
         id: 'xcomponent',
         type: XComponentType.TEXTURE,//原来为SURFACE
         controller: this.xComponentController,
         libraryname: 'entry'
       })
         .onLoad(() => {
           // this.xComponentController.setXComponentSurfaceSize({ surfaceWidth:480  , surfaceHeight: 640 })
           // this.surfaceId = this.xComponentController.getXComponentSurfaceId()
           // console.info('onLoad over ')
         })
         .width('100%')
         .height('100%')
         .backgroundColor("#000000")//必须为黑色。

 

Logo

社区规范:仅讨论OpenHarmony相关问题。

更多推荐