GithubHelp home page GithubHelp logo

uncn / banner_disuse Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 1.0 1.93 MB

Banner is an open source Android library that allows developers to easily create an ad rotation effect widget like those made in Tmall,Taobao apps. This item has been stopped for maintenance, please visit

Home Page: https://github.com/ShortStickBoy/banner

License: Apache License 2.0

Java 100.00%
android android-library banner tmall taobao

banner_disuse's Introduction

Banner

Banner is an open source Android library that allows developers to easily create an ad rotation effect widget like those made in Tmall,Taobao apps.

ScreenShot

sample

Gradle

dependencies {
    implementation 'com.github.ShortStickBoy:Banner:2.2.0'
}

Attribute

Attribute Describe Additional
banner_inch Milliseconds per inch The greater the value, the slower the slide
banner_interval Waiting time before next slide The greater the value, the longer the wait
indicator_show Whether to display the indicator True display, false not displayed
indicator_gain Indicator drawable when gets the focus Support color, svg and image reference
indicator_miss Indicator drawable when lost the focus Support color, svg and image reference
indicator_size Indicator icon size The larger the value, the larger the icon
indicator_space Indicator icon spacing The larger the value, the larger the icon interval
indicator_margin Indicator_margin The larger the value, the larger the margin
indicator_gravity Indicator_gravity Default center, support left, right

How to use

1. Add Banner view to your layout.

    <com.sunzn.banner.library.Banner
        android:id="@+id/banner"
        android:layout_width="match_parent"
        android:layout_height="120dp"
        app:indicator_gravity="right"
        app:indicator_gain="@drawable/svg_indicator_icon_gain"
        app:indicator_miss="@drawable/svg_indicator_icon_miss" />

2. Create a java bean class.

    private class Bean {

        String url;

        Bean(String url) {
            this.url = url;
        }

        String getUrl() {
            return url;
        }
    }

3. Set Banner data and set OnItemClickListener, OnItemBindListener.

    Banner<Bean> banner = findViewById(R.id.banner);

    banner.setBannerData(beans);
    banner.setOnItemClickListener(new Banner.OnItemClickListener<Bean>() {
        @Override
        public void onItemClick(int position, Bean item) {
            // TODO
        }
    });
    banner.setOnItemBindListener(new Banner.OnItemBindListener<Bean>() {
        @Override
        public void onItemBind(int position, Bean item, ImageView view) {
            Glide.with(getApplicationContext()).load(item.getUrl()).into(view);
        }
    });

License

    Copyright [2017-2018] sunzn

    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.

banner_disuse's People

Contributors

uncn avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

hellhckr

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.