Keyboard Overlaps Edittext - Activity Fullscreen
NickName:Bansi Doshi Ask DateTime:2016-08-24T13:34:55

Keyboard Overlaps Edittext - Activity Fullscreen

I am working on chat application where Edittext and send button is at bottom. Activity is fullscreen, hidden navigation and status bar. I need to push edittext and send button up when keyboard comes into focus.

Below is my activity theme and code in activity to hide bar and make full screen :

 decorView = getWindow().getDecorView();
    uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
            | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;

Theme :

 <style name="AppTheme_DarkStatus" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryveryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
    <item name="android:windowContentTransitions">true</item>
    <item name="android:windowDrawsSystemBarBackgrounds">true</item>

XMl :

 <RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@+id/include_view"
    android:isScrollContainer="true"
    android:background="@android:color/white">

    <com.handmark.pulltorefresh.library.PullToRefreshListView
        xmlns:ptr="http://schemas.android.com/apk/res-auto"
        android:id="@+id/lv_chat"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_above="@+id/rl_send"
        android:divider="@null"
        android:fadeScrollbars="false"
        android:fadingEdge="none"
        android:overScrollMode="never"
        android:scrollbars="none"
        ptr:ptrHeaderSubTextColor="@color/c_input_text_color"
        ptr:ptrHeaderTextColor="@color/c_input_text_color"
        ptr:ptrOverScroll="false"
        ptr:ptrPullLabel="Pull to refresh"
        ptr:ptrRefreshLabel="Loading..."
        ptr:ptrReleaseLabel="Release to refresh"
        ptr:ptrRotateDrawableWhilePulling="true"
        ptr:ptrShowIndicator="false" >
    </com.handmark.pulltorefresh.library.PullToRefreshListView>

    <RelativeLayout
        android:id="@+id/rl_send"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:background="@color/c_white"
        android:gravity="center" >

        <View
            android:id="@+id/view_dummy"
            android:layout_width="match_parent"
            android:layout_height="@dimen/d_diff_p5dp"
            android:background="@color/c_text_light_color" />

        <RelativeLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/view_dummy"
            android:layout_toLeftOf="@+id/btn_send"
            android:layout_marginRight="@dimen/d_diff_5dp"
            android:layout_marginLeft="@dimen/d_diff_10dp"
            android:layout_marginTop="@dimen/s_diff_7sp"
            android:layout_marginBottom="@dimen/s_diff_7sp"
            android:background="@drawable/opawhite_rectcorner_all" android:id="@+id/relativeLayout">

            <EditText
                android:id="@+id/et_message"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="@dimen/d_diff_1dp"
                android:background="@null"
                android:focusableInTouchMode="true"
                android:maxHeight="100dp"
                android:hint="Type here..."
                android:maxLength="150"
                android:textSize="@dimen/s_diff_16sp"
                android:padding="@dimen/s_diff_6sp"
                android:textColorHint="@color/c_input_text_color"
                android:textColor="@color/c_black" />
        </RelativeLayout>

        <Textview
            android:id="@+id/btn_send"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@color/c_white"
            android:text="Send"
            android:padding="@dimen/d_diff_5dp"
            android:layout_marginRight="@dimen/d_diff_5dp"
            android:gravity="center"
            android:textColor="@color/c_orange_main"
            android:textSize="@dimen/s_diff_16sp"
            android:layout_centerVertical="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentEnd="true"/>
    </RelativeLayout>
</RelativeLayout>

I want to show edittext and send button above keyboard but it overlaps edittext.

Thanks!

Copyright Notice:Content Author:「Bansi Doshi」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/39115148/keyboard-overlaps-edittext-activity-fullscreen

More about “Keyboard Overlaps Edittext - Activity Fullscreen” related questions

Keyboard Overlaps Edittext - Activity Fullscreen

I am working on chat application where Edittext and send button is at bottom. Activity is fullscreen, hidden navigation and status bar. I need to push edittext and send button up when keyboard come...

Show Detail

Swype keyboard overlaps on EditText

I have 2 Linear layouts. One containing a list view and another with an EditText. When I am typing in EditText swype keyboard overlaps on it. How can i make EditText floating? (means when swype key...

Show Detail

Softkeyboad Autocorrection field overlaps EditText

So, when you open the keyboard and it overlaps the EditText you clicked into, the whole Screen moves up so the EditText is just above the Keyboard. This does work for me however as I said, it moves...

Show Detail

Keyboard overlaps Custom edit text

I have a an EditText with a drawable background (A rectangle shape with corners and a color, nothing fancy) Case 1 When the EditText gets focus on click, view shifts above but the soft keyboard st...

Show Detail

Android keyboard overlaps ListView

I have a problem, I have a ListView and an EditText designed like this: &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/to...

Show Detail

Make editText to fullscreen

I want to make editText become fullscreen when I want to type something on it. something like this: at first I was able to do this without doing anything, but then I tried to use external keyboar...

Show Detail

Activity fullscreen DialogFragment contain EditText not resize when keyboard show

&lt;style name="Full.Theme" parent="Theme.AppCompat.Light.NoActionBar"&gt; &lt;item name="android:windowTranslucentStatus"&gt;false&lt;/item&gt; &lt;item name="android:windowTr

Show Detail

Soft keyboard overlaps views under EditText inside BottomSheetDialogFragment

I have simply EditText and Button below this EditText in my BottomSheetDialogFragment &lt;ConstraintLayout&gt; &lt;EditText/&gt; &lt;Button/&gt; &lt;/ConstraintLayout&gt; And when soft keyboa

Show Detail

How to keep the state of keyboard same of previous activity?

In my activity I have a list of images and one EditText. When I click the image, I use intent to display image in fullscreen activity. when I press the back button the keyboard does not in the same...

Show Detail

Android Soft Keyboard hiding EditText when reopened

I am developing an app that requires screen pinning and a full window so I hide the navigation bar etc. When the activity opens and the EditText gains focus the Soft Keyboard will become visible a...

Show Detail