How to use BottomSheetDialog?

前端 未结 5 449
暖寄归人
暖寄归人 2021-02-03 19:41

I want to try BottomSheetDialog introduced in Android Support Library 23.2 but it doesn\'t seem to work correctly. Here is what the doc says:

5条回答
  •  被撕碎了的回忆
    2021-02-03 20:15

    Instead of having a separate class, you can simply create an instance for BottomSheetDialog in your Activity/Fragment like following and you can use it. It is very easier and simpler I think.

    val dialog = BottomSheetDialog(this)
    val bottomSheet = layoutInflater.inflate(R.layout.bottom_sheet, null)
    
    bottomSheet.buttonSubmit.setOnClickListener { dialog.dismiss() }
    
    dialog.setContentView(bottomSheet)
    dialog.show()
    

    For brief tutorial you can refer here

提交回复
热议问题