android recyclerview show hide item with animation with default animation

Solutions on MaxInterview for android recyclerview show hide item with animation with default animation by the best coders in the world

showing results for - "android recyclerview show hide item with animation with default animation"
Anton
19 Jul 2019
1import android.animation.Animator;
2import android.animation.AnimatorListenerAdapter;
3import android.view.View;
4
5public final class AnimationUtils {
6
7  public static void slideDown(final View view) {
8        view.animate()
9                .translationY(view.getHeight())
10                .alpha(0.f)
11                .setListener(new AnimatorListenerAdapter() {
12                    @Override
13                    public void onAnimationEnd(Animator animation) {
14                        // superfluous restoration
15                        view.setVisibility(View.GONE);
16                        view.setAlpha(1.f);
17                        view.setTranslationY(0.f);
18                    }
19                });
20    }
21
22    public static void slideUp(final View view) {
23        view.setVisibility(View.VISIBLE);
24        view.setAlpha(0.f);
25
26        if (view.getHeight() > 0) {
27            slideUpNow(view);
28        } else {
29            // wait till height is measured
30            view.post(new Runnable() {
31                @Override
32                public void run() {
33                    slideUpNow(view);
34                }
35            });
36        }
37    }
38
39    private static void slideUpNow(final View view) {
40        view.setTranslationY(view.getHeight());
41        view.animate()
42                .translationY(0)
43                .alpha(1.f)
44                .setListener(new AnimatorListenerAdapter() {
45                    @Override
46                    public void onAnimationEnd(Animator animation) {
47                        view.setVisibility(View.VISIBLE);
48                        view.setAlpha(1.f);
49                    }
50                });
51    }
52
53}
queries leading to this page
hide view animation android to topifi visible slide upview up and down kotlin animation based on view gone and visiblefrom gone to visible show slide animation androidvisible layout with animation in androidhide and show image with animation in androidkotlin hide show view transitionhide and show view with animation androidhow to animate viewandroid slide up animation programmaticallytwo layout one below another hide unhide animation kotlinandroid studio showing visibility animationhow to add a slide down animation to a viewhow to animate a view slide down to originalandroid recyclerview show hide item with animation with default animationandroid studio xml animation not visiblehow to hide a view with left to right animationalign layout below another view after animationshowing views with animationhow to show a animationandroid animation height hideandroid visibility slidehide slowly animation androidhow to make slider unvisible in horizontal sliding view android studiolayout hide with animation in androidanimation view visibility kotlinshow up animation to not hideshow hide view with fade animation kotlinslide view up and down based on view visibility androidandroid show animation on hide show view defaultslideup animation without bar androidshow hide view with animation kotlinanimate view visibility from top to bottomandroid recyclerview show hide slide animationlinear layout animation android goneandroid show and hide a view with aslide animationandroid recyclerview doesn update itemandroid animation hide widget keep stateandroid view show hide animationkotlin view hide show animation setshow and hide the view from position animation swiftandroid slide animation viewview gone animation android slowandroid animation hideview gone animation slowadd animation when hiding visibility kotlinandroid linearlayout animation slideshow upward animation when click java buttonandroi view slide animation androidanimate view gone with androidhow to show animation in androidhow to smoothly hide a layout in android programmaticallyslide view animation android misses flagandroid hide view with animationshow hide view with animation androidandroid studio view to go up and down transitionandroid recyclerview show hide item with animation with default animation