android - DialogFragment allowing clicking activity behind -


i started dialogfragment activitya, when click on white background of dailogfragment there no elements, click event happening on activitya in background

public class filterdialog extends dialogfragment{      private static final string tag = "filterdialog";     calendar mycalendar = calendar.getinstance();     private string stringdate;       datepickerdialog.ondatesetlistener date = new datepickerdialog.ondatesetlistener() {          @override         public void ondateset(datepicker view, int year, int monthofyear,                           int dayofmonth) {             monthofyear++;             stringdate = dayofmonth+"-"+ monthofyear +"-"+year;         }      };      @override     public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) {          view rootview = inflater.inflate(r.layout.dialog_filter, container, false);          toolbar toolbar = (toolbar) rootview.findviewbyid(r.id.toolbar);         toolbar.settitle("filter");         button datepicker = (button) rootview.findviewbyid(r.id.datepicker);         view.onclicklistener datepicklistener = new view.onclicklistener() {              @override             public void onclick(view v) {                 if(v.getid() == r.id.datepicker){                     new datepickerdialog(v.getcontext(), date,                                     mycalendar.get(calendar.year),                                    mycalendar.get(calendar.month),                                    mycalendar.get(calendar.day_of_month)).show();                  }             }         };         datepicker.setonclicklistener(datepicklistener);          ((appcompatactivity) getactivity()).setsupportactionbar(toolbar);          actionbar actionbar = ((appcompatactivity) getactivity()).getsupportactionbar();         if (actionbar != null) {             actionbar.setdisplayhomeasupenabled(true);             actionbar.sethomebuttonenabled(true);             actionbar.sethomeasupindicator(android.r.drawable.ic_menu_close_clear_cancel);         }         return rootview;     }      @nonnull     @override     public dialog oncreatedialog(bundle savedinstancestate) {         dialog dialog = super.oncreatedialog(savedinstancestate);         dialog.requestwindowfeature(window.feature_no_title);         return dialog;     }      @override     public void onstart()     {         super.onstart();         final alertdialog d = (alertdialog)getdialog();         if(d != null)         {             button positivebutton = (button) d.getbutton(dialog.button_positive);             positivebutton.setonclicklistener(new view.onclicklistener()             {                 @override                 public void onclick(view v)                 {                     boolean wanttoclosedialog = false;                      if(wanttoclosedialog)                         d.dismiss();                  }             });         }     } } 

this dialogfragment, show dialogfragment used

fragmentmanager fragmentmanager = getsupportfragmentmanager(); filterdialog newfragment = new filterdialog(); fragmenttransaction transaction = fragmentmanager.begintransaction(); transaction.settransition(fragmenttransaction.transit_fragment_open); transaction.replace(android.r.id.content, newfragment).addtobackstack(null).commit(); 

screenshot

as shown in above screenshot, if click on of highlighted color, click happening on activitya in background , not visible. can me disable this.

make android:clickable=true root layout behind dialog


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -