Search code examples
androidlistviewzoominghorizontal-scrollinghorizontallist

Android Horizontal Images slider


Hi I need to achieve a horizontal image scroller in which the images towards the centre will be zoomed more.

Required Image scrolller style

I could achieve somewhat close with horizontal listview and Circular drawable. Now I nedd means to give a focus to items in centre by applying a zoom How can this be achieved ?

This is what I have done so far Achieved so far

Thank You


Solution

  • Sorry that time by mistake half answer got posted, i am not sure with values but logic is proper , just calculate the mid element in onscroll listener and get the view and apply the animation.
    This should be implemented in your onScrollListener of your listview.

     @Override
                public void onScroll(AbsListView view, int firstVisibleItem,
                        int visibleItemCount, int totalItemCount) {
                            int start = firstVisibleItem ;
                            int end = start + visibleItemCount ;
                           // calculate the mid element
                            int midElement = start + visibleItemCount/2;
                            View imageView = getchildAt(midElement - start);
                           //apply animation
                        }
            }