GithubHelp home page GithubHelp logo

sivabe35 / quickscroll Goto Github PK

View Code? Open in Web Editor NEW

This project forked from andraskindler/quickscroll

1.0 2.0 0.0 1.83 MB

Bringing extended scrolling features to Android's native ListView and ExpandableListView.

Java 100.00%

quickscroll's Introduction

About QuickScroll

QuickScroll is a library aimed at creating similar scrolling experiences to the native Contacts app's People view. It has the same scrolling capabilities as the ListView's native fastscroll, but comes with a much a much more customizable design, two indicator styles and an allways visible scrollbar. The two most common modes are popup and indicator. Works seamlessly with ListView and ExpandableListView. Check out the demo application, available in the Play Store.

QuickScroll works great with basically any third party library, in fact, it's just a lightveight View subclass with few lines of initialization code. For more info check out this blog post.

Usage

A project with mulitple working samples can be found in the /sample folder.

  1. Include the widget in your layout. Currently, you can only put it to the right side of the ListView, this can be done via a RelativeLayout, a LinearLayout or any other positioning trick of your choice. The default width is 30 dp, but if you really want to change it, you can do it via an object method.

     <com.andraskindler.quickscroll.QuickScroll
     android:id="@+id/quickscroll"
     android:layout_width="wrap_content"
     android:layout_height="match_parent"/>
    
  2. Implement the Scrollable interface in your BaseExpandableListAdapter or BaseAdapter subclass. You must override the methods below.

    The first function returns the corresponding String to display at any given position:

     @Override
     public String getIndicatorForPosition(int childposition, int groupposition) {
         return null;
     }
    

    The second function is responsible for is for implementing scroll behaviour. This can be used to perform special tasks, e.g. if you want to snap to the first item starting with a letter in an alphabetically ordered list or jump between groups in an ExpandableListView. If you want the normal approach, simply return childposition.

     @Override
     public int getScrollPosition(int childposition, int groupposition) {
     return 0;
     }
    
  3. Initialize the QuickScroll widget:

     final QuickScroll quickscroll = (QuickScroll) layout.findViewById(R.id.quickscroll);
     quickscroll.init(QuickScroll.TYPE_INDICATOR, listview, adapter, QuickScroll.STYLE_HOLO);
    

    The first parameter assigns the type, the second and third binds the ListView (or ExpandableListView) and its adapter. The last one defines the style, currently there are two available:

    • STYLE_HOLO creates a scrollbar fitting into stock holo design.
    • STYLE_NONE creates a transparent scrollbar, so you can create a fully customised underlying layout.

    Both styles also come with a _WITH_HANDLE suffix, creating a holo-themed handlebar on the scrollbar.

  4. (Optional) Do some customizing: change the colors, sizes and font styles. This can be done via object methods.

Including in your app

QuickScroll is available as an Android Library Project. In Eclipse, you can include it by referencing as a library project, in IntelliJ, you can add it as a module.

Other notices

The lowest supported API level is 8 (FroYo)

Developed by Andras Kindler ([email protected])

License

Copyright 2013 Andras Kindler

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.

quickscroll's People

Contributors

andraskindler avatar 4emodan avatar likebamboo avatar

Stargazers

SivaShankar avatar

Watchers

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