While going through the chapter Dialogs and Dialog Fragments, I took the sample app Dialogs/DialogFragment a tad bit further by adding another 7 LinearLayout blocks containing a title TextView and an EditText. I was testing how I would be able to access the bottom views; would it let me scroll the views or would I have to hide the keyboard if I need to go to, let’s say, the last EditText field. Also, I wanted to see how I can access the positive and negative buttons. Would they be visible as a footer if the views can’t fit the screen; and what would happen when the keyboard is on screen.
I tried wrapping up the whole view in a ScrollView, added the following in menifest.
Overridden onViewCreated() (couldn’t think of a better place to put this line in) of the fragment and added the following in it before calling the super method:
Following is the result:
As long as the keyboard is not visible, the things go fine: dialog title stays as a header, buttons as footer and the custom layout shows in the middle and we can scroll it to access all the views.
When the soft keyboard is on screen, button are never accessible, dialog title is visible as long as the there is enough space on screen for it to be shown. When we try to access the bottom views, it scrolls away, although it ain’t part of the ScrollView.
So, is there a way to design the custom view such that the title stays on screen as a header, the buttons as a footer, and the custom layout in the middle is scrollable whether or not the soft keyboard is visible?