Skip to content

milkmidi/android_parallaxImageView

Repository files navigation

android ParallaxImageView

Android Parallax Effect on ListView / ScrollView

alt tag

Code Example

mListView = (ListView) this.findViewById( R.id.list_ivew );
mListView.setOnScrollListener( this );
@Override   //AbsListView.OnScrollListener
public void onScroll( AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount ) {
    int childCount = view.getChildCount();
    int listHeight = view.getHeight();
    for ( int i = 0; i < childCount; i++ ) {
        View child = view.getChildAt( i );
        Holder holder = (Holder) child.getTag();
        float top = child.getTop();
        int childHeight = child.getHeight();

        float t = top+childHeight;
        float tot = listHeight+childHeight;

        float fraction = getFraction(t , tot/2 , tot);
        holder.image.setFraction( fraction );
    }
}

Installation

API Reference

Contributors

License

A short snippet describing the license (MIT, Apache, etc.)

About

android_parallaxImageView

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages