Wednesday, 12 February 2014

Fragment dialog with scroll view doesn't scroll - solution

There is possibility, you will have scrollview inside dialog fragment plus with many buttons and the view won't move.

To fix it you should do the same thing like with activities by adjusting windowSoftInputMode in dialog theme.

You should set custom theme for your fragment dialog by inheriting current android dialog and adding windowSoftInputMode option:

 <style name="DialogFragmentStyle" parent="@android:style/Theme.Dialog">  
     <item name="android:windowSoftInputMode">stateHidden|adjustResize</item>  

Use your theme in your fragment dialog while creating constructor

 Dialog dialog = new Dialog(getActivity(),;  

 public class MyFragmentDialog extends DialogFragment{  
   public Dialog onCreateDialog(Bundle savedInstanceState) {  
     Dialog dialog = new Dialog(getActivity(),;  
     return dialog;  
   //... other methods