Giter Club home page Giter Club logo

imagecarouselview's Introduction

ImageCarouselView

Custom image carousel view for Android. Support featrures:

  • Infinite auto-scroll (ALWAYS in one direction)
  • Scrollable manually with auto-scroll
  • Auto-settle to the closest position on scrolling manually

demo

Note: The library does not provide ways for loading images from URL. You could use libraries like Glide (see the example), Picasso, Fresco or write your own.

Limitations

  • Only support horizontal scroll
  • Only support images from URL
  • Manual scroll does not work smoothly inside NestedScrollView

QuickStart

This is a example of using Glide as image loader. See the example app for more details.

  • Create a image loader class extend ImageLoader and implement loadImage
private class GlideImageLoader extends ImageLoader {
        @Override
        protected void loadImage(String url, final OnResourceReadyListener listener) {
            // your own image loading logic here
            Glide.with(ExampleActivity.this)
                    .load(Uri.parse(url).normalizeScheme()).asBitmap()
                    .into(new SimpleTarget<Bitmap>() {
                        @Override
                        public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
                            // must call this when bitmap resource is ready
                            listener.onResourceReady(resource);
                        }
                    });
        }
}

PS: make sure to call onResourceReady when the image bitmap is ready

  • Add ImageCarouselView into your layout XML
<com.f3401pal.imagecarouselview.ImageCarouselView
        android:id="@+id/carouselView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        />
  • Set the image URLs and a instance of your image loader in ImageCarouselView
ImageCarouselView carouselView = (ImageCarouselView) findViewById(R.id.carouselView);
carouselView.setImageUrls(URLs, new GlideImageLoader());

imagecarouselview's People

Contributors

f3401pal avatar

Stargazers

 avatar Marcos Rocha avatar  avatar

Watchers

James Cloos avatar  avatar

Forkers

nadz016

imagecarouselview's Issues

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.