harmonyos实战关于静态图片存放以及image图片引入
编写demo轮播图的时候,用到图片,想到静态资源具体存放在哪里??
官网工程目录结构解释:文档中心
Resource资源
使用资源格式可以跨包/跨模块引入图片,resources文件夹下的图片都可以通过$r资源接口读取到并转换到Resource格式。
Image($r('app.media.icon'))
Swiper() {Image($r('app.media.image1')).width('90%').height('100')Text('1').width('90%').height('100').backgroundColor(Color.Green).textAlign(TextAlign.Center).fontSize(30)Text('2').width('90%').height('100').backgroundColor(Color.Pink).textAlign(TextAlign.Center).fontSize(30)}.loop(true).autoPlay(true).interval(1000).displayArrow({showBackground: true,isSidebarMiddle: true,backgroundSize: 24,backgroundColor: Color.White,arrowSize: 18,arrowColor: Color.Blue}, false)