Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public Dialog onCreateDialog(Bundle savedInstanceState) {
- final Dialog d = super.onCreateDialog(savedInstanceState);
- // view hierarchy is inflated after dialog is shown
- d.setOnShowListener(new DialogInterface.OnShowListener() {
- @Override
- public void onShow(DialogInterface dialogInterface) {
- //this disables outside touch
- d.getWindow().findViewById(R.id.touch_outside).setOnClickListener(null);
- //this prevents dragging behavior
- View content = d.getWindow().findViewById(R.id.design_bottom_sheet);
- ((CoordinatorLayout.LayoutParams) content.getLayoutParams()).setBehavior(null);
- }
- });
- return d;
- }
- override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
- val d = super.onCreateDialog(savedInstanceState)
- //view hierarchy is inflated after dialog is shown
- d.setOnShowListener {
- //this disables outside touch
- d.window.findViewById<View>(R.id.touch_outside).setOnClickListener(null)
- //this prevents dragging behavior
- (d.window.findViewById<View>(R.id.design_bottom_sheet).layoutParams as CoordinatorLayout.LayoutParams).behavior = null
- }
- return d
- }
Add Comment
Please, Sign In to add comment