# DecentBanner **Repository Path**: ts_ohos/DecentBanner ## Basic Information - **Project Name**: DecentBanner - **Description**: 一个简单的循环banner视图 - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-08-20 - **Last Updated**: 2022-09-16 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # DecentBanner 本项目是基于开源项目 DecentBanner 进行 harmonyos 化的移植和开发的,可以通过项目标签以及 [github地址](https://github.com/chengdazhi/DecentBanner) 移植版本:源master1.0.7版本 ## 项目介绍 ### 项目名称:DecentBanner ### 所属系列:harmonyos的第三方组件适配移植 ### 功能: * 平滑的浮标运动动画和标题不透明度动画。 * 您可以在左上角选择启用logo。 * 兼容少于3个项目的横幅。 * 可指定自动滚动间隔和动画持续时间。 * 启动和停止自动滚动的公共方法。 * 无限循环。 ### 项目移植状态:完全移植 ### 调用差异:基本没有使用差异,请参照demo使用 ### 原项目Doc地址:https://github.com/chengdazhi/DecentBanner ### 编程语言:java ### 项目截图(涉及文件仅供demo测试使用) ![demo运行效果](art/art.png) ![运行效果](art/demo.gif) ## 安装教程 #### 方案一 可以先下载项目,将项目中的decentbanner库提取出来放在所需项目中通过build配置 ```Java dependencies { implementation project(":decentbanner") } ``` #### 方案二 - 1.项目根目录的build.gradle中的repositories添加: ```groovy buildscript { repositories { ... mavenCentral() } ... } allprojects { repositories { ... mavenCentral() } } ``` - 2.开发者在自己的项目中添加依赖 ```groovy dependencies { implementation 'com.gitee.ts_ohos:decentbanner:1.0.0' } ``` ## Features * Smooth buoy movement animation and title opacity animation. * You can choose to enable logo at the top left corner. * Compatible to banners with less than three items. * You can specify the auto scroll interval and animation duration. * public methods to start and stop auto scroll. * Infinite loop. ## Usage * To initiate your DecentBanner, first acquire DecentBanner instance mDecentBanner in Java or XML, then: /** * @param views the list of views that you want to include in the banner * @param titles the list of titles that appears as tabs at the bottom * @param intervalSeconds the interval of auto scrolling, set to 2 in sample * @param animationMillis the scrolling's animation time, set to 500 in sample * @param int logoResourceId | Bitmap logoBitmap the logo you want to display. You can skip this param if you don't want it. */ mDecentBanner.start(List views, List titles, int intervalSeconds, int animationMillis[, int logoResourceId | Bitmap logoBitmap]); * Note that when you want to show less than 3 views, you need to extend the views to be no less than three items. When you want to display 2 views, your titles param should contain 2 items and your views param should contain 4 items as ABAB * You can call the following two methods to start/stop auto scrolling. mDecentBanner.startAutoPlay(); mDecentBanner.stopAutoPlay(); * You can call these method to enable/disable gradient cover or to query whether the cover is enabled mDecentBanner.setGradientEnabled(boolean enabled); mDecentBanner.isGradientEnabled(); ## License Copyright 2016 chengdazhi 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.