代码拉取完成,页面将自动刷新
1.在项目根目录下的build.gradle文件中,
allprojects {
repositories {
maven {
url 'https://s01.oss.sonatype.org/content/repositories/releases/'
}
}
}
2.在entry模块的build.gradle文件中,
dependencies {
implementation('com.gitee.chinasoft_ohos:RevealBanner:1.0.0')
......
}
在sdk6,DevEco Studio 2.2 Beta2下项目可直接运行 如无法运行,删除项目.gradle,.idea,build,gradle,build.gradle文件, 并依据自己的版本创建新项目,将新项目的对应文件复制到根目录下
<StackLayout
ohos:width="match_parent"
ohos:height="220vp">
<com.wikikii.bannerlib.banner.view.BannerBgContainer
ohos:id="$+id:banner_bg_container"
ohos:height="220vp"
ohos:width="match_parent"/>
<com.wikikii.bannerlib.banner.LoopLayout
ohos:id="$+id:loop_layout"
ohos:height="150vp"
ohos:width="match_parent"
ohos:layout_alignment="bottom"
ohos:bottom_margin="40vp"/>
</StackLayout>
// 设置轮播图属性
loopLayout.setLoop_ms(3000);//轮播的速度(毫秒)
loopLayout.setLoop_duration(400);//滑动的速率(毫秒)
loopLayout.setScaleAnimation(true);// 设置是否需要动画
loopLayout.setIndicatorLocation(IndicatorLocation.Center);//指示器位置-中Center
loopLayout.initializeData(this);
// 设置轮播图属性end
// 准备数据
ArrayList<BannerInfo> bannerInfos = new ArrayList<>();
List<Object> bgList = new ArrayList<>();
bannerInfos.add(new BannerInfo(R.mipmap.banner_1, "first"));// 注意: 使用网络图片只需把 R.mipmap.banner_1 替换为网络图片地址即可
bannerInfos.add(new BannerInfo(R.mipmap.banner_2, "second"));
bgList.add(R.mipmap.banner_bg1);
bgList.add(R.mipmap.banner_bg2);
// 设置监听
loopLayout.setOnLoadImageViewListener(new OnDefaultImageViewLoader() {
@Override
public void onLoadImageView(ImageView view, Object object) {
Glide.with(view.getContext())
.load(object)
.into(view);
}
});
loopLayout.setOnBannerItemClickListener(this);
if (bannerInfos.size() == 0) {
return;
}
loopLayout.setLoopData(bannerInfos);// 设置轮播数据
bannerBgContainer.setBannerBackBg(this, bgList);// 背景容器设置轮播图片
loopLayout.setBannerBgContainer(bannerBgContainer);// 联动
loopLayout.startLoop();// 开始循环
CodeCheck代码测试无异常
CloudTest代码测试无异常
病毒安全检测通过
当前版本demo功能与原组件基本无差异
Copyright 2019, tokiii
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
1. 开源生态
2. 协作、人、软件
3. 评估模型