8

I've been searching all around but I can't find an answer that helps solve this particular problem. My application has a custom slide-in, slide-out effect used like this:

Intent intent = new Intent(getApplicationContext(), MyActivity.class);
startActivity(intent);
overridePendingTransition(R.anim.slide_right_in, R.anim.slide_right_out);

The Problem

The problem is I have a BottomNavigation included in all activities, and I don't want it to get animated, I want to exclude it.

enter image description here

What I'm trying to achieve

I want to exclude the Bottom Navigation from the animation. Or, in other words, how can I only animate the content between transitions?

enter image description here

EDIT: I already tried doing with Shared Element, but I wanted it to work below API 21.

3
  • Maybe you do an shared element transition with it ? did this help ? stackoverflow.com/questions/27658577/… Commented Apr 16, 2017 at 2:52
  • I'm sorry, I forgot to include I also wanted it to work below API 21. At least, in API 17. Commented Apr 16, 2017 at 2:55
  • @ChristophMayr Since I'm using animations with overridePendingTransition, how can I call the method excludeTarget(findViewById(bottomNavId), true); ? Commented Apr 16, 2017 at 2:59

1 Answer 1

4

It's not possible to exclude components form overridePendingTransition() API. Instead, you have to move to Transitions API. Particularly, this is Slide transition animation, where you exclude your bottom navigation view.

Transition slide = new Slide(Gravity.RIGHT);
slide.excludeTarget(bottomNavigationView, true);
getWindow().setEnterTransition(slide);

See detailed implementation here.

You can see support transition package which backports Transitions API functionality upto API 14. But I couldn't find Slide transition in the classes list. Otherwise you can use TransitionEverywhere.

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.