Search code examples
androidkotlinlayoutandroid-coordinatorlayoutbottom-sheet

Bottomsheet Layout height issues


I have have a ConstraintLayout with com.google.android.material.bottomsheet.BottomSheetBehavior inside a CoordinatorLayout

The problem is, when I click on the edittext inside the bottomsheet and the keyboard appears, the bottomsheet changes his height. It happens on several cases, for example when I close keyboard, when I click a pin on the map.

Seems more like an android bug, is there a fix for that?

enter image description here


Solution

  • I solved the problem by updating the com.google.android.material:material from 1.0.0 to 1.1.0-alpha07 and adding to the bottomsheet behavior the following code:

    bottomSheetBehavior.saveFlags = BottomSheetBehavior.SAVE_ALL

    Hope it will save time for somebodyelse.