Editing text on an Android keyboard

I have edit text on my page and I need to adjust the screen to display the entered values.

I have an action bar on my page and I gave android:windowSoftInputMode="adjustPan|stateAlwaysHidden".

When I launch the application, I touch the edit text and keyboard. Now the edit text is on top of the keyboard, which is true. But when I start typing, the edit text goes down the keyboard.

This does not happen on all devices. Samsung S3 has this problem. How to solve this? Please help me.

Edit:

My external code is as follows:

<EditText
            android:id="@+id/name"
            android:layout_width="300dp"
            android:layout_height="50dp"
            android:layout_below="@+id/empId"
            android:layout_marginTop="10dp"
            android:ellipsize="end"
            android:hint="@string/name"
            android:inputType="text"
            android:maxLines="1"
            android:padding="5dp"
            android:textColor="@android:color/black" />
0
source share
1 answer

I had a similar problem. What I was doing was adding a linear layout below the root layout, such as

  <LinearLayout
        android:orientation="vertical"
        android:id="@+id/footer_for_emoticons"
        android:layout_width="match_parent"
        android:layout_height="@dimen/keyboard_height"
        android:visibility="gone" >
    </LinearLayout> 

activityRootView.getViewTreeObserver().addOnGlobalLayoutListener(
                new OnGlobalLayoutListener() {
                    @Override
                    public void onGlobalLayout() {
                        Rect r = new Rect();
                        activityRootView.getWindowVisibleDisplayFrame(r);

                        int heightDiff = activityRootView.getRootView()
                                .getHeight() - (r.bottom - r.top);
                        if (lastDiff == heightDiff)
                            return;
                        lastDiff = heightDiff;
                        Log.i("aerfin","arefin "+lastDiff);
                        if (heightDiff > 100) { //Assume keyboard is present 
                            emoticonsCover.setVisibility( View.VISIBLE );
                            flag2 = 0;
                        } else {
                            if (flag == false)
                                flag2 = 1;
                               emoticonsCover.setVisibility( View.GONE );
                        }
                    }
                });

android: windowSoftInputMode = "adjustPan" . ,

0

All Articles