Search code examples
androidandroid-layoutandroid-fragmentstextviewandroid-edittext

Android edittext view getting trimmed on text input


I have a linear layout and on the bottom of it I have an EditText.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   android:paddingLeft="16dp"
   android:paddingRight="16dp"
   android:orientation="vertical"
   android:gravity="center">

<LinearLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent">
    <TextView
        android:id="@+id/text_view_id"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:text="@string/hello" />
<TextView
        android:id="@+id/title"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:text="@string/hello" />
<TextView
        android:id="@+id/description"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:text="@string/hello" />
 </LinearLayout>

  <EditText
     android:id="@+id/plain_text_input"
     android:layout_height="wrap_content"
     android:layout_width="match_parent"
     android:inputType="text"/>
 </LinearLayout>

The problem is that when I run the app and click on the edittext the keyboard pops up and trims whatever I am typing so the text being type is not visible during typing as soon as I exit the edittext it becomes visible does anyone have a suggestion on how to make sure that the edittext view is visible while we enter the data and does not get trimmed by keyboard?


Solution

  • Try to add the below line in the manifest file in your particular Activity

    android:windowSoftInputMode="adjustPan" 
    

    as explained here