question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bottom Navigation View] Height increase after destroying the foreground app and reopening

See original GitHub issue

Description: Full description of issue here I am working on a sample app that uses Material 3 bottom navigation view, everything looks good on the first launch but when you destroy the app and reopen it again, it increases the height of the bottom nav view when height is set to wrap parent

Expected behavior: Screenshots and/or description of expected behavior On First Launch - Screenshot_1639023876

After - Screenshot_1639023885

Source code: The code snippet which is causing this issue. Please consider attaching a minimal sample app that reproduces the issue.

<com.google.android.material.bottomnavigation.BottomNavigationView
     android:id="@+id/bottom_navigation"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     app:layout_constraintBottom_toBottomOf="parent"
     app:layout_constraintEnd_toEndOf="parent"
     app:layout_constraintHorizontal_bias="0.5"
     app:layout_constraintStart_toStartOf="parent"
     app:menu="@menu/bottom_navigation_menu"/>

Android API version: Android API version here Target - 31 Compile - 31

Material Library version: Material Android Library version you are using here (e.g., 1.1.0-alpha07) 1.6.0-alpha01

Device: Device on which the bug was encountered here

  1. Emulator running on API 31
  2. Pixel 4XL running on Android 12

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
robertlevonyancommented, Dec 18, 2021
class NoPaddingBottomNavigation @JvmOverloads constructor(
  context: Context, attrs: AttributeSet? = null
) : BottomNavigationView(context, attrs) {

  init {
    setOnApplyWindowInsetsListener(null)
    setPadding(0)
  }
}

this works for me

1reaction
hunterstichcommented, Dec 9, 2021

Hi @abhishekds94,

Thanks for filing an issue! Would you be able to attach your sample? I tried re-creating your scenario but wasn’t able to reproduce the issue you’ve described.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Bottom Navigation View] Height increase after destroying the ...
Run the app on API 31 based emulator/device - notice the standard height on the bottom nav bar; Now, kill the app from...
Read more >
BottomNavigationView - How to avoid recreation of Fragments ...
The problem is that every time i click on the button to change the view for example from recents to favorites it creates...
Read more >
[Solved]-UI issues when closing and reopening the app in iOS6
When app goes in background OS can reduce memory usage for your app, so background view may be released. Try reloading background every...
Read more >
Activity state changes - Android Developers
Activity or dialog appears in foreground ... When a configuration change occurs, the activity is destroyed and recreated.
Read more >
Memory leak in stack navigator · Issue #7078 - GitHub
Current Behavior What code are you running and what is happening? Android memory consumption is increasing as pages are pushed onto the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found