0

I am developing a simple image quiz application where i need a zoom-in and zoom-out animation for the card view used in the layout. I need to zoom-in the selected card by say 10% and zoom-out and blur the remaining cards by 10%. I have attached the layout for reference and need some inputs on how it can be achieved. The entire layout presented here is inside a custom ViewPager.

cardview-animation

1 Answers1

0

Something like this....

View gridView;                    // Assume your items are attached to this View
ArrayList<View> itemViewList;     // Each item views

public void selectItem(int index) {
    for(int i=0; i<itemViewList.size; i++) {
        if(index == i)
            itemViewList.get(i).animate().scaleX(1.05f).scaleY(1.05f).setDuration(150);
        else
            itemViewList.get(i).animate().scaleX(1).scaleY(1).setDuration(150);
    }
}


Btw you cannot achieve FANCY blur effect by this way.
Check this article.

Community
  • 1
  • 1
Suhyeon Lee
  • 569
  • 4
  • 18