I use BottomDialog from github library https://github.com/shaohui10086/BottomDialog/

BottomDialog.create(thisA.getSupportFragmentManager()) .setViewListener(new BottomDialog.ViewListener() { @Override public void bindView(View v) { initView(v); // // You can do any of the necessary the operation with the view } }) .setLayoutRes(R.layout.dialog_layout) .setDimAmount(0.2f) // Dialog window dim amount(can change window background color), range:0 to 1,default is : 0.2f .setCancelOutside(true) // click the external area whether is closed, default is : true .setTag("BottomDialog") // setting the DialogFragment tag .show(); 

After it appeared, how can it be closed programmatically?

    1 answer 1

    BottomDialog is a descendant of the DialogFragment class ; this class has a dismiss method .
    Try this:

     BottomDialog dialog = BottomDialog.create(thisA.getSupportFragmentManager()) .setViewListener(new BottomDialog.ViewListener() { @Override public void bindView(View v) { initView(v); // // You can do any of the necessary the operation with the view } }) .setLayoutRes(R.layout.dialog_layout) .setDimAmount(0.2f) // Dialog window dim amount(can change window background color), range:0 to 1,default is : 0.2f .setCancelOutside(true) // click the external area whether is closed, default is : true .setTag("BottomDialog") // setting the DialogFragment tag .show() 

    and then in the right place to call:

     dialog.dismiss(); 
    • Thank you very much! - Anton