【问题标题】:How to dismiss Bottom Sheet fragment when click outside in Kotlin?在 Kotlin 中单击外部时如何关闭底部工作表片段?
【发布时间】:2020-04-28 18:40:03
【问题描述】:

我像这样制作底部片断:

val bottomSheet = PictureBottomSheetFragment(fragment)
bottomSheet.isCancelable = true
bottomSheet.setListener(pictureListener)
bottomSheet.show(ac.supportFragmentManager, "PictureBottomSheetFragment")

但是当我触摸外面时它不会消失。并解雇或 isCancelable 不起作用。

【问题讨论】:

标签: android kotlin bottom-sheet android-bottomsheetdialog


【解决方案1】:

试试这个

behavior.setState(BottomSheetBehavior.STATE_HIDDEN));

【讨论】:

  • 如果你不能解决你的问题,你可以试试这个 -> behavior.setState(BottomSheetBehavior.STATE_COLLAPSED)
猜你喜欢
  • 1970-01-01
  • 2020-02-28
  • 2023-02-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-09-02
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多