Coder Social home page Coder Social logo

hgy413 / carouselbanner Goto Github PK

View Code? Open in Web Editor NEW

This project forked from iwdael/carouselbanner

0.0 1.0 0.0 2.3 MB

CarouselBanner 是一款展示图片或者广告的控件。它使用简单,不依赖其他第三方框架,而且把图片加载的过程通过接口的方式让使用者自行实现。

License: Apache License 2.0

Java 100.00%

carouselbanner's Introduction

CarouselBanner



CarouselBanner 是一款展示图片或者广告的控件。它使用简单,不依赖其他第三方框架,而且把图片加载的过程通过接口的方式让使用者自行实现。
Image Text

Image Text

使用说明

CarouselBanner可以设置滚动的方向,例如水平和垂直,也可以设置滚动的速度,滚动间隔时间,以及指示器的位置。CarouselBanner是普通的轮播控件,如果你想使用带有放缩效果的轮播控件,请使用CoolCarouselBanner。

代码示例

自定义加载器

public class ImageFactory implements CarouselImageFactory {
    @Override
    public void onLoadFactory(String url, ImageView view) {
        Glide.with(view).load(url).into(view);
    }
}

初始化

Banner.init(new ImageFactory());

添加到布局

    <!--<com.hacknife.carouselbanner.CarouselBanner-->
    <com.hacknife.carouselbanner.CoolCarouselBanner
        android:id="@+id/banner"
        android:layout_width="match_parent"
        android:layout_height="200dp"
        app:autoPlaying="true"
        app:indicatorGravity="left"
        app:indicatorSelectedSrc="#d6c2c2"
        app:indicatorUnselectedSrc="#df0000"
        app:orientation="horizontal"
        app:speedPerPixelMillisecond="0.8" />

绑定数据

    banner = findViewById(R.id.banner);
    banner.setOnCarouselItemChangeListener(...);//滚动监听
    banner.setOnCarouselItemClickListener(...);//点击监听
    list.add("http://.............jpg");
    banner.initBanner(list);

快速引入项目

合并以下代码到需要使用的Module的dependencies中。

	dependencies {
                ...
	        implementation 'com.hacknife:carouselbanner:1.1.2'
	}

感谢浏览

如果你有任何疑问,请加入QQ群,我将竭诚为你解答。欢迎Star和Fork本仓库,当然也欢迎你关注我。
Image Text

carouselbanner's People

Contributors

iwdael avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.