A scrollView added to framelayout , and linearlayout1 with multiple linearlayout1 scrolling up / down and linearLayout2 for an enlarged view container.

Those. each view can increase when you click on it, and when this happens, a linearLayout2 container linearLayout2 , which is initially invisible.

Is it possible to somehow linearLayout2 container linearLayout2 in the center of the screen (display)? The fact is that all layoutParams (including gravity) provide for the alignment of the child element with respect to the parent, and here you need alignment with the screen, i.e. so that, when linearLayout2 clicked, linearLayout2 an indent above = 0 from the top edge of the display and occupies the entire available width and height of the display.

    1 answer 1

    I can offer two options. The first is to create a custom DialogFragment and attach a linearLayout2 to it, while setting the dimensions must be done in the onResume() fragment. The second option is to use WindowManager to create a so-called System overlay window . The second option is more flexible, but there are certain permission issues for API 23+.

    • Everything seemed to work with DialogFragment, but I still couldn’t figure out how to handle the tag that was passed to it from the activation method in the DialogFragment itself? How to get this tag in the fragment itself? - VolhaGomel
    • Arguments in DialogFragment are passed by forming the usual Bundle followed by a dialogFragment.setArguments(bundle) . Well, respectively, getArguments() in the fragment itself - Serodv
    • By the way, you are wrong, you can get the tag String tag = this.getTag (); - VolhaGomel