How to disable BottomSheetDialogFragment dragging

后端 未结 14 1463
猫巷女王i
猫巷女王i 2021-01-31 04:58

How to disable BottomSheetDialogFragment dragging by finger?

I saw similar questions, but they\'re all about BottomSheet not BottomSheetD

14条回答
  •  终归单人心
    2021-01-31 05:42

    This is my solution:

    setOnShowListener {
                Handler().post {
                    val bottomSheet = findViewById(R.id.design_bottom_sheet) as? FrameLayout
                    bottomSheet?.let {
                        BottomSheetBehavior.from(it).state = STATE_EXPANDED
    
                        // Disable dialog dragging behavior which causes issue on EditText scroll!
                        BottomSheetBehavior.from(it).isDraggable = false
                    }
    
                }
            }
    

提交回复
热议问题