0

I have a dialog with an edit text inside. Once I open the keyboard I have two options : 1. resize the layout - and then the edittext is simply gone(visually). 2. pan - the edit text is shown partially and I do see every line I write in it. BUT - the keyboard hides the Button at the bottom of the dialog (beneath the edittext)

I know it's possible in iOS. But is it possible in Android to simply lift the dialog to the top so that only half of it is seen ?

here's a picture to depict what I'm aiming at : enter image description here

BVtp
  • 2,308
  • 2
  • 29
  • 68
  • Just wrap your layout in a `ScrollView`. – earthw0rmjim Aug 24 '16 at 07:30
  • of the dialog itself? or the one hosting it – BVtp Aug 24 '16 at 07:38
  • I think this post might answer your question: http://stackoverflow.com/questions/5622202/how-to-resize-alertdialog-on-the-keyboard-display?answertab=active#tab-top **getWindow().setSoftInputMode( WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);** – Monu Surana Aug 24 '16 at 07:38

3 Answers3

1

In your Manifest file add the following code for this particular activity

<activity android:name="yourActivity"
          android:windowSoftInputMode="adjustPan" >
</activity>

Check this doc for more info.

EDIT

try these.. may it works for you.

  1. android:windowSoftInputMode="adjustPan|adjustResize"
  2. android:windowSoftInputMode="stateVisible|adjustResize"
Jitesh Prajapati
  • 2,533
  • 4
  • 29
  • 51
0

Use adjustResize with adjustPan

 android:windowSoftInputMode="adjustPan|adjustResize" 

if it looks ugly then use ScrollView in dailog by using customview.

Sohail Zahid
  • 8,099
  • 2
  • 25
  • 41
0

For dialog, you need to do it in the dialog.

dialog!!.window!!.setSoftInputMode( WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
Rohaitas Tanoli
  • 624
  • 4
  • 16