GithubHelp home page GithubHelp logo

simpleviewpagerindicator's Introduction

This has been forked from https://github.com/Papercloud/SimpleViewPagerIndicator. However, since leaving Papercloud I don't have access to the repository anymore. Any future updates to SimpleViewPagerIndicator will be pushed here instead.

SimpleViewPagerIndicator

SimpleViewPagerIndicator is a small, easy to use class that you can add to your Android projects to graphically display the number of elements in a ViewPager, as well as allow users to quickly switch pages by touching the page indicators.

SimpleViewPagerIndicator screenshot

After checking out some existing libraries for doing similar things, I found that many were overly complicated for what I was trying to accomplish. SimpleViewPagerIndicator is designed to allow developers to specify a simple (hence the name), customisable container in an XML layout file, and add elements (in the case of the screenshot, light bulbs) on the fly. The elements have two states - normal, and highlighted. Changing pages simply changes the image state.

Included in this repository is the SimpleViewPagerIndicator class itself, as well a a sample indicator layout file and a few small images.

Installation

  • Add the SimpleViewPagerIndicator class, view_pager_indicator.xml layout file and sample images to your project.

  • Import your project's R file in SimpleViewPagerIndicator.

  • In your activity's layout file, add:

      <au.com.papercloud.pager.SimpleViewPagerIndicator
          android:id="@+id/page_indicator"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:gravity="center" />
    
  • In your activity that contains a ViewPager, just add:

      SimpleViewPagerIndicator pageIndicator = (SimpleViewPagerIndicator) findViewById(R.id.page_indicator);
      pageIndicator.setViewPager(pager);
    
  • Of course, you may also create the indicator in code and add it to your activity's content view.

  • Any time the view pager's data is changed, be sure to call

      pageIndicator.notifyDataSetChanged();
    
  • Change the layout file and images to your heart's content.

If you intend to add an OnPageChangeListener to your view pager, add it to the SimpleViewPagerIndicator instead.

Notes

This is a simple set of files that I've decided to open source because I thought it'd be useful to someone else. In no way is it guaranteed to be highly optimised nor bug free. If anyone has any suggestions for improvement, please create a pull request.

Licence

This project is licenced under the Apache Licence v2. You may use and change as you wish. No attribution is required.

Developed by Jarrod Robins 2012, 2013.

simpleviewpagerindicator's People

Contributors

jarrodrobins avatar marchold avatar

Watchers

James Cloos avatar  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.