1

I am trying to display a view under the Bottom Navigation Bar to show a message to the user.

  • This view needs to be hidden with a Translation Animation.

The current behaviour without an animation looks as per the attachment below

behaviour without animation

When performing the animation, the section covered by the Translation Animation is then removed from the screen and leaves a blank space (which I cannot get rid of it):

behaviour with animation

Here is the code for the Animation:

public void hideGlobalAppMessage(){
    //Animation that hides the green message down
    globalMessageContainer.animate()
            .translationY(globalMessageContainer.getHeight())
            .setDuration(500);

    //Animation that moves the bottom navigation bar down
    navBar.animate()
            .translationY(globalMessageContainer.getHeight())
            .setDuration(500);
}

Is there any alternate way to perform this animation without getting this issue?

Thanks in advance

Juan Manuel Amoros
  • 347
  • 1
  • 5
  • 17

1 Answers1

1

Can you share your XML codes for this page. What's your root layout constraint, linear or relative if constraint layout maybe you didn't constraint recyclerview bottom point.

oztrna
  • 95
  • 6
  • 1
    Hi, thanks a lot for pointing me into the right direction, I thought it was an Animation issue but as you said it was related to my layout.xml. I had several items positioned under a Linear Layout and once one of the child views was getting hidden it was leaving that blank space. I found the solution under this SO thread: https://stackoverflow.com/questions/12302172/setvisibilitygone-view-becomes-invisible-but-still-occupies-space – Juan Manuel Amoros Sep 23 '18 at 10:34