Home > Enterprise >  How can I solve this problem.EditText is little bit occupied by Keyboard
How can I solve this problem.EditText is little bit occupied by Keyboard

Time:11-21

Plss help how to solve this problem.

[This is the picture after I clicked the EditText ][1] [1]: https://i.stack.imgur.com/Pc8iO.jpg

I have seen many answer that you must replace the adjustPan to adjustResize

[But when I try to replace adjustPan to adjustResize this is the result ][2] [2]: https://i.stack.imgur.com/MooPU.jpg

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

    <Button
        android:paddingTop="18dp"
        android:paddingBottom="18dp"
        android:text="send"
        android:id="@ id/button_send"
        android:layout_width="60dp"
        android:layout_height="52dp"
        android:layout_gravity="bottom|right|center"/>

    
    
    <EditText
        
        android:layout_marginRight="60dp"
        android:background="#EBEBEB"
        android:layout_marginBottom="4dp"
        android:id="@ id/mainEditText"
        android:hint="Type your message here..."
        android:layout_gravity="bottom"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:ems="10"
        android:inputType="textMultiLine"
        android:maxLines="8"
        android:minHeight="48dp"
        android:minLines="1"
        android:paddingLeft="10dp"/>
    <RelativeLayout
        android:layout_gravity="top"
        android:layout_width="match_parent"
        android:layout_height="563dp"
        android:orientation="vertical">
        
        
        
        <ListView
            android:layout_gravity="top"
            android:id="@ id/messages_view"
            android:layout_width="fill_parent"
            android:layout_height="match_parent"
            android:divider="@null"
            android:dividerHeight="0dp"
            android:listSelector="@android:color/transparent"
            android:stackFromBottom="true"
            android:transcriptMode="normal"></ListView>
        
        
    </RelativeLayout>
    

CodePudding user response:

In the manifest.xml file, add the following line to the <activity> tag :

android:windowSoftInputMode="stateHidden|adjustPan" 

CodePudding user response:

I have the same problem as you. This is because the top of the keyboard is always hooked to the end of the text inside EditText. I solved it by doing a trick, adding paddingVertical to the EditText so that it can be put in further position from the keyboard

  • Related