Android navigation box

I am new to android. I have a problem with Android navigator. I turned on the navigation box in my application, everything is going well, but I was wondering if anyone could help me get the lazy animation in the list of navigation boxes.

navigation drawer with animation

Image source .

Thanks.

+7
android navigation-drawer android-animation
source share
1 answer

Maybe the best way, but I came across this. You can achieve the effect of a delayed slide using RecyclerView and customize the animation in the onBindViewHolder method.

The code below is adapted from "how to set up animation on RecyclerView elements when they appear." I adapted it to stagger position based animation. You will also need logic to stop calling the setAnimation method after all positions for the initially visible views are called up if you do not want them to move to the left when the user scrolls.

How to animate RecyclerView elements when they appear (adapted)

@Override public void onBindViewHolder(ViewHolder holder, int position) { holder.text.setText(items.get(position)); // Here you apply the animation when the view is bound setAnimation(holder.container, position); } /** * Here is the key method to apply the animation */ private void setAnimation(View viewToAnimate, int position) { Context context = MyApp.getActivity(); Animation animation = AnimationUtils.loadAnimation(context, android.R.anim.slide_in_left); animation.setDuration(position * 50 + 200); viewToAnimate.startAnimation(animation); } 

Animating too many views can become very volatile. Increasing the interval delay leaves a larger screen, while earlier ones will animate. You can try to find some animations (besides the default android) that will leave them on the screen longer (for example, pause, then move or speed them up) so that you can better control how many views are animated on the screen at the same time.

+2
source share

All Articles