4

In the pictures below you can see 2 EditText nicely standing next to each-other. When I click on one EditText, it navigates me to the view (no problem). But when I click on the EditText next to it, the navigation send me a little upwards instead of staying on the same height. Anther problem is when I click in the previous EditText, bugging out the height and hiding the EditText from the view.

Normal

enter image description here

Click first (ok)

enter image description here

Click on the next one (problem)

enter image description here

Click back on the previous one (biggest problem), I end up a little below the view

enter image description here

Code:

<activity
            android:name=".activity.ReportsEditActivity"
            android:configChanges="orientation|screenSize"
            android:label="@string/title_activity_reports_edit"
            android:parentActivityName=".activity.MainActivity"
            android:windowSoftInputMode="adjustResize|stateVisible">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value=".activity.MainActivity" />
        </activity>

Edittext:

<EditText
        android:id="@+id/report_template_grid_single_line_edit_text"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginEnd="@dimen/grid_padding"
        android:layout_marginStart="@dimen/grid_padding"
        android:inputType="text"
        android:maxHeight="@dimen/grid_element_max_height"
        android:maxLines="1"
        android:minHeight="@dimen/grid_element_min_height"
        android:paddingBottom="@dimen/grid_element_top_and_bottom_padding"
        android:gravity="top|start"
        android:paddingEnd="@dimen/grid_element_top_and_bottom_padding"
        android:paddingStart="@dimen/grid_element_top_and_bottom_padding"
        android:paddingTop="@dimen/grid_element_top_and_bottom_padding"
        android:textColor="@color/darkGray"
        android:textSize="@dimen/grid_text_size_small" />
Aniruddh Parihar
  • 3,072
  • 3
  • 21
  • 39
BrianM
  • 951
  • 2
  • 12
  • 29
  • Try adding adjust pan for windowsoftinput in manifest – Jins Lukose Sep 30 '18 at 20:32
  • What's your entire layout file like? According to the dev site: "...if you use a relative layout to place a button bar at the bottom of the screen, using "adjustResize" resizes the layout so the button bar appears above the input method." So my best guess is Android is getting confused where to draw the views based on your layout or perhaps even your java code depending on how you handle the click listener of the `EditText` view. (Since it might remember being in the previous EditText and the listener can be activated for that view when returning to it, and also possibly before you left it.) – Mr.Drew Oct 07 '18 at 05:43
  • need to see more info - please provide entire XML layout and Activity class – Mardann Oct 07 '18 at 10:15
  • Could You share the project? – deadfish Oct 07 '18 at 18:58

1 Answers1

0

According to to developer document here. https://developer.android.com/guide/topics/manifest/activity-element

Adjust resize keep activity's main window is always resized to make room for the soft keyboard on screen.

So you might need to use adjustPan something like this

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

and when user hits back key you can handle the back key event in onBackpressed method to hide the soft keyboard.

Ramesh Yankati
  • 1,197
  • 9
  • 13