3 Star 8 Fork 0

ISRC_OHOS / ContinuousScrollableImageView_ohos

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
README.md 3.73 KB
一键复制 编辑 原始数据 按行查看 历史
isrc_ohos 提交于 2021-11-16 05:33 . update README.md.

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

输入图片说明

项目介绍

编程语言:Java

安装教程

下载加载动画jar包continuousscrollableimageview.jar。 启动 DevEco Studio,将下载的jar包,导入工程目录“entry->libs”下。 在moudle级别下的build.gradle文件中添加依赖,在dependences标签中增加对libs目录下jar包的引用,随后执行gradle sync。

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar', '*.har'])
	……
}
使用说明

布局文件定义,提供控件:ContinuousScrollableImageView 引入方法:import com.cunoraz.continuousscrollable.ContinuousScrollableImageView; ContinuousScrollableImageView布局、属性设置,这里使用了两种方式进行布局,其中飞机图像和云图像使用的是正常方式进行布局和属性设置,山图像使用的是Builder方式进行布局和属性设置:

//飞机图像布局
        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
版权和许可信息
Java
1
https://gitee.com/isrc_ohos/continuous-scrollable-image-view_ohos.git
git@gitee.com:isrc_ohos/continuous-scrollable-image-view_ohos.git
isrc_ohos
continuous-scrollable-image-view_ohos
ContinuousScrollableImageView_ohos
master

搜索帮助