Java Code Examples for android.support.v7.widget.RecyclerView#setLayoutAnimation()

The following examples show how to use android.support.v7.widget.RecyclerView#setLayoutAnimation() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ws_Main3Activity.java    From styT with Apache License 2.0 5 votes vote down vote up
private void runLayoutAnimation(final RecyclerView recyclerView) {
    final Context context = recyclerView.getContext();
    final LayoutAnimationController controller = AnimationUtils.loadLayoutAnimation(context, R.anim.layout_animation_fall_down);
    recyclerView.setLayoutAnimation(controller);
    recyclerView.getAdapter().notifyDataSetChanged();
    recyclerView.scheduleLayoutAnimation();
}
 
Example 2
Source File: MyLayoutAnimationHelper.java    From RecyclerViewAnimation with Apache License 2.0 5 votes vote down vote up
public static void applyAnimation(RecyclerView recyclerView) {
    LayoutAnimationController controller = new LayoutAnimationController(getAnimationSetFromLeft());
    controller.setDelay(0.1f);
    controller.setOrder(LayoutAnimationController.ORDER_NORMAL);

    recyclerView.setLayoutAnimation(controller);
    recyclerView.getAdapter().notifyDataSetChanged();
    recyclerView.scheduleLayoutAnimation();
}