Harmony Next -- 图片选择库:宫格展示、全屏预览

hm_image_select_view

OpenHarmony三方库中心仓:https://ohpm.openharmony.cn/#/cn/detail/image_select_view

介绍

Harmony Next 图片选择库,可设置最大选择数量、单行显示数量、横向竖向间隔;点击图片后全屏预览

软件架构

Harmony next版本,兼容API12

效果图

安装教程
  1. ohpm install image_select_view
使用说明
  1. 引入仓库

基础使用:

复制代码
import { CommonTitleBar, TitleType } from '@ohos/commonTitleBar'
import { ImageSelectView } from '@ohos/imageSelectView';

@Component
export struct ImagePage {
  build() {
    NavDestination() {
      Scroll() {
        Column() {
          CommonTitleBar({
            leftType: TitleType.NONE,
            centerType: TitleType.TEXT,
            centerText: "图片选择器",
          })

          Text("选择图片、全屏预览")

          ImageSelectView({
            maxSelect: 9, // 最大选择数
            columns: 4, // 一行显示数
            gutterX: 10, // 横向间隔
            gutterY: 10, // 竖向间隔
            onImageListChange: (images) => {
              console.log("PZR_TAG", "Images:" + JSON.stringify(images))
            }
          })
            .margin({
              left: 10,
              right: 10,
            })
            
           Text("展示图片、全屏预览")

          ImageSelectView({
            columns: 4, // 一行显示数
            gutterX: 10, // 横向间隔
            gutterY: 10, // 竖向间隔
            isPreview: true, // 仅作为展示和预览使用,常用于详情页
            imageList: [
              "https://hm-pzr.obs.cn-east-3.myhuaweicloud.com/hm/image_select1.png",
              "https://img-blog.csdnimg.cn/img_convert/fce61a2a73dd039a254ad37d546ed373.png",
              "https://hm-pzr.obs.cn-east-3.myhuaweicloud.com/hm/image_select1.png",
              "https://img-blog.csdnimg.cn/img_convert/fce61a2a73dd039a254ad37d546ed373.png",
              "https://hm-pzr.obs.cn-east-3.myhuaweicloud.com/hm/image_select1.png",
              "https://hm-pzr.obs.cn-east-3.myhuaweicloud.com/hm/image_select1.png",
              "https://hm-pzr.obs.cn-east-3.myhuaweicloud.com/hm/image_select1.png",
              "https://hm-pzr.obs.cn-east-3.myhuaweicloud.com/hm/image_select1.png",],
          })
            .margin({
              left: 10,
              right: 10,
            })
        }
      }
    }
    .backgroundColor($r('sys.color.comp_background_focus'))
    .hideTitleBar(true)
  }
}
相关推荐
Huanzhi_Lin10 小时前
Laya导出的鸿蒙NEXT工程目录说明
华为·harmonyos·鸿蒙·laya·deveco·devecostudio·layaair
纯爱掌门人16 小时前
聊聊 HarmonyOS 上的应用内通知授权弹窗
前端·harmonyos·arkts
不喝水就会渴17 小时前
从基础到实战:鸿蒙 ArkUI 属性动画开发指南
华为·交互·动画·harmonyos
代码论斤卖18 小时前
OpenHarmony teecd频繁崩溃问题分析
linux·harmonyos
南村群童欺我老无力.19 小时前
鸿蒙 - TextInput高度设置的边界行为
华为·harmonyos
木斯佳19 小时前
HarmonyOS 悬浮球实战:从页面内组件到 SubWindow 方案
harmonyos·悬浮球
Lanren的编程日记21 小时前
Flutter 鸿蒙应用AR功能集成实战:多平台AR框架+模拟模式,打造增强现实体验
flutter·ar·harmonyos
南村群童欺我老无力.21 小时前
鸿蒙PC开发的Slider组件blockSize参数的类型要求
华为·harmonyos
前端技术1 天前
华为余承东:鸿蒙终端设备数突破5500万
java·前端·javascript·人工智能·python·华为·harmonyos
Lanren的编程日记1 天前
Flutter 鸿蒙应用启动速度优化实战:优先级并行初始化+懒加载,全方位提升启动体验
flutter·华为·harmonyos