0

我正在开发一个简单的图像测验应用程序,其中我需要放大和缩小布局中使用的卡片视图的动画。我需要放大选定的卡片,比如说10%,然后缩小并将其余卡片模糊10%。我附上了布局以供参考,并且需要一些关于如何实现的信息。这里介绍的整个布局是在一个自定义的ViewPager中。Android Cardview放大和缩小动画

cardview-animation

回答

0

事情是这样的....

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); 
    } 
} 


顺便说一句,你不能达到通过这种方式FANCY模糊效果。
Check this article.