# ContinuousScrollableImageView_ohos **Repository Path**: isrc_ohos/continuous-scrollable-image-view_ohos ## Basic Information - **Project Name**: ContinuousScrollableImageView_ohos - **Description**: HarmongOS平台上具有连续滚动效果的图像控件。 - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 8 - **Forks**: 0 - **Created**: 2021-03-12 - **Last Updated**: 2022-09-06 ## Categories & Tags **Categories**: harmonyos-image **Tags**: HarmonyComponent ## README # ContinuousScrollableImageView_ohos **本项目是基于开源项目ContinuousScrollableImageView进行鸿蒙化的移植和开发的,可以通过项目标签以及github地址( https://github.com/Cutta/ContinuousScrollableImageView )追踪到原安卓项目版本** ##### 项目介绍 项目名称:开源连续滚动图像控件 所属系列:鸿蒙的第三方组件适配移植 功能:可以显示具有连续滚动效果的图像,支持设置图像源、缩放类型、持续时间和方向。 项目移植状态:90% 调用差异:现在只能通过java代码来实现,具体的调用方式见下方实例。 开发版本:sdk5,DevEco Studio2.1 beta3 项目发起作者:刘磊 邮箱:792301176@qq.com 原项目Doc地址:https://github.com/Cutta/ContinuousScrollableImageView ![输入图片说明](https://gitee.com/CLANNAD-2020/continuous-scrollable-image-view_ohos/raw/master/screenshot/1615522106494.gif "在这里输入图片标题") ##### 项目介绍 编程语言:Java ##### 安装教程 下载加载动画jar包continuousscrollableimageview.jar。 启动 DevEco Studio,将下载的jar包,导入工程目录“entry->libs”下。 在moudle级别下的build.gradle文件中添加依赖,在dependences标签中增加对libs目录下jar包的引用,随后执行gradle sync。 ```groovy dependencies { implementation fileTree(dir: 'libs', include: ['*.jar', '*.har']) …… } ``` ##### 使用说明 布局文件定义,提供控件:ContinuousScrollableImageView 引入方法:import com.cunoraz.continuousscrollable.ContinuousScrollableImageView; ContinuousScrollableImageView布局、属性设置,这里使用了两种方式进行布局,其中飞机图像和云图像使用的是正常方式进行布局和属性设置,山图像使用的是Builder方式进行布局和属性设置: ```java //飞机图像布局 LayoutConfig planeConfig=new LayoutConfig(ComponentContainer.LayoutConfig.MATCH_PARENT,0,LayoutConfig.UNSPECIFIED_ALIGNMENT,1); ContinuousScrollableImageView plane=new ContinuousScrollableImageView(this); plane.setLayoutConfig(planeConfig); plane.setDirection(ContinuousScrollableImageView.RIGHT); plane.setDuration(2500); plane.setScaleType(ContinuousScrollableImageView.CENTER_INSIDE); plane.setResourceId(ResourceTable.Media_plane); layout.addComponent(plane); //云图像布局 LayoutConfig cloudConfig=new LayoutConfig(ComponentContainer.LayoutConfig.MATCH_PARENT,0,LayoutConfig.UNSPECIFIED_ALIGNMENT,1); ContinuousScrollableImageView cloud=new ContinuousScrollableImageView(this); cloud.setLayoutConfig(cloudConfig); cloud.setDirection(ContinuousScrollableImageView.LEFT); cloud.setDuration(4000); cloud.setResourceId(ResourceTable.Media_cloud); layout.addComponent(cloud); //山图像Builder方式布局 LayoutConfig mountainConfig=new LayoutConfig(ComponentContainer.LayoutConfig.MATCH_PARENT,0,LayoutConfig.UNSPECIFIED_ALIGNMENT,1); ContinuousScrollableImageView mountain=new ContinuousScrollableImageView.Builder(this.getAbility()) .setDirection(ContinuousScrollableImageView.LEFT) .setDuration(6000) .setResourceId(ResourceTable.Media_mountain) .build(); mountain.setLayoutConfig(mountainConfig); layout.addComponent(mountain); ``` 可以使用通过setDirection来设置方向,setDuration设置时间间隔,setScaleType设置缩放类型,setResourceId设置图像源。 ##### 版本迭代 - v0.1.0-alpha ##### 版权和许可信息 - ContinuousScrollableImageView_ohos经过[Apache License, version 2.0](http://www.apache.org/licenses/LICENSE-2.0)授权许可。