android - Making DialogFragment window scrollable -


i'm having problem dialogs don't scroll when content large screen. assume because dialogs not displayed within scrollable containers.

enter image description here

screenshot contains content wrapped in scrollview - can see content scrollable

extra fields added artificially increase dialog size example

you can see android developer documentation dialogs should wrapped within dialogfragments (this gives benefit of having dialogs survive orientation change , response lifecycle events) , set i'm trying make work.

much of other answers i've found similar 1 , revolve around ensuring window set "adjustresize". however, make parent view smaller on keyboard opening, wouldn't make view scrollable if wasn't in scrollable container.

if let me know if have info make dialog scrollable or confirm cannot make dialog scrollable i'd appreciate it.

this possibly dirtiest , break solution problem:

after creating dialog in oncreatedialog() before returning can achieve scrolling adding code:

    final viewgroup content = (viewgroup) dialog.findviewbyid(android.r.id.content);     content.getviewtreeobserver().addongloballayoutlistener(new viewtreeobserver.ongloballayoutlistener() {         @override         public void ongloballayout() {             content.getviewtreeobserver().removeglobalonlayoutlistener(this);             view inner = content.getchildat(0);             content.removeviewat(0);             scrollview scrollview = new scrollview(getcontext());             scrollview.addview(inner);             content.addview(scrollview);         }     }); 

Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -