2

I have two fragments in an activity where one fragment takes up 70% and the other one 30%. I wanted to show a pop up window / dialog to be center aligned in 70% fragment and the fragment should be dimmed while showing the popup. Any pointers on how to proceed ?

Nick
  • 185
  • 1
  • 12

2 Answers2

3

Place a semi-transparent, hidden, Drawable over the top of the 70% fragment (within it's layout description). When you need the dimming, just change the state of that drawable to visible, and when the dialog is gone, set it back to hidden.

Greyson
  • 3,598
  • 1
  • 21
  • 22
2

Set setTargetFragment() on the DialogFragment in the Host Fragment

Call getTargetFragment(); on the Host Fragment in the DialogFragment

and dim the view of the Host by

private void dimTheHostView() {
  view = hostFragment.getView();
  if (view != null) {
    view.setAlpha(0.4f);
  }
}
Bade
  • 119
  • 1
  • 6