Avoid the initial vertical position of BottomSheetDialogs being capped.

This commit is contained in:
azuo
2021-09-13 11:55:29 +08:00
parent 0dbbe0e5d2
commit 1389ddbfc0
9 changed files with 41 additions and 12 deletions

View File

@ -86,7 +86,6 @@ class BottomSheetPicker<T>(
withContext(Dispatchers.Main) {
binding.loader.isVisible = false
binding.listContainer.addView(listBinding.root)
this@BottomSheetPicker.behavior.state = BottomSheetBehavior.STATE_EXPANDED
binding.listContainer.isVisible = true
val idx = items.toList().indexOfFirst { it.value == getSelected?.invoke() }
@ -95,6 +94,10 @@ class BottomSheetPicker<T>(
})
setContentView(binding.root)
behavior.run {
skipCollapsed = true
state = BottomSheetBehavior.STATE_EXPANDED
}
super.show()
}