-1

So, I am using the following part of the code to get Input but as soon as the keyboard appears the text gets hidden under the Hint as in this gif. How do I prevent this from happening.

<LinearLayout
    android:layout_width="330dp"
    android:layout_height="0dp"
    android:layout_gravity="center"
    android:layout_weight="0.1"
    android:orientation="horizontal">

    <android.support.design.widget.TextInputLayout
        android:id="@+id/input_layout"
        android:layout_width="100dp"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_weight="0.8">

        <EditText
            style="@style/Widget.AppCompat.AutoCompleteTextView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="3dp"
            android:layout_marginRight="10dp"
            android:hint="Enter message here..." />
    </android.support.design.widget.TextInputLayout>
Achal Sharma
  • 152
  • 1
  • 11

3 Answers3

1

In your manifest put it in the activity causing the problem

android:windowSoftInputMode="adjustPan"
0

Please add your layout in ScrollView

<ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <LinearLayout
    android:layout_width="330dp"
    android:layout_height="0dp"
    android:layout_gravity="center"
    android:layout_weight="0.1"
    android:orientation="horizontal">

    <android.support.design.widget.TextInputLayout
        android:id="@+id/input_layout"
        android:layout_width="100dp"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_weight="0.8">

        <EditText
            style="@style/Widget.AppCompat.AutoCompleteTextView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="3dp"
            android:layout_marginRight="10dp"
            android:hint="Enter message here..." />
    </android.support.design.widget.TextInputLayout>
    </LinearLayout>
    </ScrollView>

and in AndroidManifest.xml add this code in your activity

<activity android:name=".ActivityName"
    android:windowSoftInputMode="adjustResize">
Mr. Ad
  • 333
  • 3
  • 12
0

set a height wrapcontent is causing the issue. set height in linearlayout and use matchparent in autocompletetextview

remove layout_weight if not needed

Nadil
  • 56
  • 7