2015-02-20 15 views
13

Şu anda Google Inbox'ı RecyclerView behaivior olarak uygulamaya çalışıyorum ve e-posta açılış animasyonunu çok merak ediyorum.Google Inbox gibi RecyclerViewGörüntüyü aç animasyon

Sorum şu: nasıl yapmalı? Demek istediğim, hangi yöntemi kullanıyorlar? Ebeveynleri doldurmak için ItemAnimator.dispatchChangeStarting() kullanıyor ve yüksekliğini değiştirdiler mi? Ya da başka bir şey? Ve eğer yaparlarsa, RecyclerView öğelerinin altında hafifçe görülebilirken, çekme hareketi ile nasıl yakınlaşırlar.

Bazı kütüphaneler veya kod parçacıkları/örneklerini işaretleme konusunda bana yardımcı olan var mı?

cevap

2

Yani: Bir yükleme öğeleri olarak recyclerviewview, veya bir kez bir öğe ve bir sonraki ekrana basın.

ben recyclerview öğeleri şarj nasıl bir örnek bırakın ve ben bir animasyon

public class CreateAnimationView { 

private static int contador; 
Integer colorFrom = R.color.myAccentColor; 
Integer colorTo = Color.RED; 

public static AnimatorSet createAnimation(View view) { 
    ObjectAnimator fadeOut = ObjectAnimator.ofFloat(view, "alpha", 
      0f); 
    fadeOut.setDuration(300); 
    ObjectAnimator mover = ObjectAnimator.ofFloat(view, 
      "translationX", -500f, 0f); 
    mover.setDuration(400); 
    ObjectAnimator fadeIn = ObjectAnimator.ofFloat(view, "alpha", 
      0f, 1f); 
    fadeIn.setDuration(300); 
    AnimatorSet animatorSet = new AnimatorSet(); 

    animatorSet.play(mover); 
    animatorSet.start(); 
    return animatorSet; 

} 
... more animations methods. 
} 
sizin RecyclerViewAdapter olarak

vermek:

@Override 
public void onBindViewHolder(ViewHolder viewHolder, int position) { 

    GruposCardView gruposCardView = gruposCardViews.get(position); 

    CreateAnimationView.createAnimationRandom(viewHolder.cardView); 
    ...} 

Ve recyclerview içinde eğer bir düzen geçebilir ve Bu animasyonu kullanın veya bundan bir tane oluşturun.

public static AnimatorSet createAnimationCollapseXY(View view) { 
    ObjectAnimator scaleXOut = ObjectAnimator.ofFloat(view, "scaleX", 1f, 0f).setDuration(400); 
    ObjectAnimator scaleXIn = ObjectAnimator.ofFloat(view, "scaleX", 0f, 1f).setDuration(300); 
    ObjectAnimator scaleYOut = ObjectAnimator.ofFloat(view, "scaleY", 1f, 0f).setDuration(400); 
    ObjectAnimator scaleYIn = ObjectAnimator.ofFloat(view, "scaleY", 0f, 1f).setDuration(300); 
    ObjectAnimator rotateClockWise = ObjectAnimator.ofFloat(view, "rotation", 0f, 360f).setDuration(400); 
    ObjectAnimator rotateCounterClockWise = ObjectAnimator.ofFloat(view, "rotation", 0f, -360f).setDuration(400); 


    AnimatorSet animatorSet = new AnimatorSet(); 

    animatorSet.playTogether(scaleXIn, scaleYIn); 
    //animatorSet.setStartDelay(1200); 
    animatorSet.start(); 
    return animatorSet; 
} 
İlgili konular