BVtp
BVtp

Reputation: 2480

hiding half dialog at the top when soft keyboard is on

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

Upvotes: 0

Views: 986

Answers (3)

Rohaitas Tanoli
Rohaitas Tanoli

Reputation: 797

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

dialog!!.window!!.setSoftInputMode( WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);

Upvotes: 0

Sohail Zahid
Sohail Zahid

Reputation: 8149

Use adjustResize with adjustPan

 android:windowSoftInputMode="adjustPan|adjustResize" 

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

Upvotes: 0

Jitesh Prajapati
Jitesh Prajapati

Reputation: 2533

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"

Upvotes: 1

Related Questions