Giter Site home page Giter Site logo

703joko / android-overscroll-listview Goto Github PK

View Code? Open in Web Editor NEW

This project forked from larphoid/android-overscroll-listview

0.0 0.0 0.0 192 KB

An 'Overscrollable' ListView with 'Bounce' effect for android ! The bounce effect can be turned off.

License: Other

Java 100.00%

android-overscroll-listview's Introduction

android-Overscroll-ListView

An 'Overscrollable' ListView with 'Bounce' effect for android !

Usage:

The bounce effect can be turned on / off with listview.setBounce(true / false).

The animation delay can be set via the delay variable, which is in milliseconds. Default = 10. The higher the value, the slower the animation.

The bounce length can be set with listview.setElasticity(float), see source file for help.

The break speed can be set with listview.setBreakspeed(float), see source file for help.

In xml, instead of creating a ListView, create a com.larphoid.overscrollinglistview.OverscrollListview

Ofcourse you can put the OverscrollListview.java in your current package and change com.larphoid.overscrollinglistview to your current package name.

When assigning the listview to a variable somewhere in your app, ofcourse you have to make it a OverscrollListview.

IMPORTANT: whenever you populate your listview, when you'r finished populating, don't forget to call listview.initializeValues().

CHANGES: after populating the listview it is not necesary anymore to set the first visible item to something other than the header or footer view (for example like this: listview.setSelectionFromTop(listview.nHeaders, listview.divHeight)), this is now done in initializeValues().

Thats it, enjoy !

Example:

The following is an example of how to include Overscrollable in your project.

package com.example.tutorial;


import android.os.Bundle;
import android.app.Activity;
import android.widget.ArrayAdapter;
import com.larphoid.overscrolllistview.OverscrollListview;

public class MainActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);

		OverscrollListview listView = (OverscrollListview)findViewById(R.id.list);

		// Defined Array values to show in ListView
		String[] values = new String[] { 
				"List item 1", 
				"List item 2",
				"List item 3",
				"List item 4", 
				"List item 5", 
				"List item 6", 
				"List item 7", 
				"List item 8" 
		};
		ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
				android.R.layout.simple_list_item_1, android.R.id.text1, values);
		listView.setAdapter(adapter); 
	}
}
<!-- activity_main.xml -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <com.larphoid.overscrolllistview.OverscrollListview
        android:id="@+id/list"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >
    </com.larphoid.overscrolllistview.OverscrollListview>

</LinearLayout>

Be sure to include the 'com.larphoid.overscrolllistview' package in your Android Project src file and you're all set.

LICENSE

This projected is licensed under the terms of the LGPL license.

android-overscroll-listview's People

Contributors

larphoid avatar dranomax 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.