Java tutorial
//package com.java2s; import android.view.View; import android.widget.LinearLayout; import android.widget.RelativeLayout; public class Main { public static void animateOut(View view) { if (view instanceof RelativeLayout) { RelativeLayout relativeLayout = (RelativeLayout) view; for (int i = 0; i < relativeLayout.getChildCount(); i++) { View child = relativeLayout.getChildAt(i); child.animate().setStartDelay(i).alpha(0).scaleX(0f).scaleY(0f); } } else { LinearLayout linearLayout = (LinearLayout) view; for (int i = 0; i < linearLayout.getChildCount(); i++) { View child = linearLayout.getChildAt(i); child.animate().setStartDelay(i).alpha(0).scaleX(0f).scaleY(0f); } } } }