2

I have a layout in an app with parallax effect on an edittext, my problem is **when I tap on the edittext softkeyboard hides my editext?**Can anybody please help me for this, I have searched for it and found about "WindowsoftInputmode" which is not working in my case.

Code in manifest

<activity
            android:name="one.tusk.stush.activities.NewPostDetailActivity"
            android:screenOrientation="portrait"
            android:windowSoftInputMode="adjustResize|adjustPan" >
Jason Aller
  • 3,541
  • 28
  • 38
  • 38
sulphuric Acid
  • 585
  • 6
  • 23
  • i tried it . It is not working in my case too. so i removed the android:windowSoftInputMode="adjustResize|adjustPan" this line then it is adjusting my layout according to keyboard – Dhiraj May 20 '16 at 11:33
  • please see my answer... – bhumika rijiya May 20 '16 at 11:36
  • @Dhiraj -bro can you help me by any refrence? – sulphuric Acid May 20 '16 at 11:41
  • @sulphuricAcid actully this should not happen if you are using android:windowSoftInputMode="adjustResize|adjustPan" but i dont know why it is giving such a weird behaviour – Dhiraj May 20 '16 at 11:42
  • @sulphuricAcid after reading ur q i tried with one edittext with android:windowSoftInputMode="adjustResize|adjustPan" property but it wont work in my case too.so i tried it with removing this property and it works but dont know why – Dhiraj May 20 '16 at 11:44
  • @sulphuricAcid please check my answer it's working in my case...!!!!! – Dhiraj May 20 '16 at 12:00
  • @sulphuricAcid Just try to replace this `android:windowSoftInputMode="adjustResize|stateHidden"` in your `Manifest`. – Jay Rathod May 20 '16 at 12:07
  • plz see my edited answer....:) – bhumika rijiya May 20 '16 at 12:21

4 Answers4

4

You should only use android:windowSoftInputMode="adjustResize".

If this is not enough, you might need to add the property android:fitsSystemWindows="true" to the root layout containing your EditText.

ThomasV
  • 779
  • 1
  • 5
  • 20
3

Try this in your manifest,

<activity
        android:name=".rapcalsy.MainActivity"
        android:windowSoftInputMode="adjustResize">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

Change your layout according this, dont miss the line which is

android:isScrollContainer="true"

 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/scrollview"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:isScrollContainer="true"
    android:orientation="vertical">

    <TableLayout
        android:layout_width="fill_parent"
        android:layout_height="match_parent"
        android:background="#000000"
        android:padding="0dp"
        android:stretchColumns="*">
        ...
    </TableLayout>
</ScrollView>
Nikolas Charalambidis
  • 40,893
  • 16
  • 117
  • 183
bhumika rijiya
  • 440
  • 1
  • 5
  • 42
2

Please try this out.

Set an android:softInputMode attribute to adjustResize in Manifest and put the parent layout inside a ScrollView. Hope this helps.

NishaL
  • 33
  • 1
  • 6
2

I tried a bit with as you said then i got this working edit the your manifest file

    <activity
                android:name="one.tusk.stush.activities.NewPostDetailActivity"
                android:screenOrientation="portrait"
                android:windowSoftInputMode="stateVisible" >

and then add below line of code in oncreate of java class

 getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);  

So that keyboard will not shown to you directly/always

Dhiraj
  • 870
  • 2
  • 12
  • 25