Dmitrii G.
Dmitrii G.

Reputation: 899

View is not resized after keyboard appear

Was following the android guidelines to make keyboard move my view aligned to bottom. But still can't make the view to be resized at all. Can you guide me on what could be going wrong?

XML:

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.app.Test"
    android:background="@android:color/white">
    <View
        android:id="@+id/statusBarBg"
        android:layout_width="fill_parent"
        android:layout_height="@dimen/toolbarPaddingTop"
        android:background="@color/testColor"/>
    <include
        android:layout_below="@id/statusBarBg"
        android:id="@+id/tool_bar"
        layout="@layout/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        />
    <EditText
        android:layout_width="fill_parent"
        android:id="@+id/crack_message"
        android:gravity="top|start"
        android:textSize="30sp"
        android:scrollbars="vertical"
        android:layout_height="wrap_content"
        android:inputType="textMultiLine|textCapSentences"
        android:maxLength="300"
        android:maxLines="10"
        android:layout_below="@id/tool_bar"
        android:layout_marginBottom="50dp"/>

    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="50dp"
        android:layout_alignParentBottom="true">
        <ImageView
            android:layout_width="30dp"
            android:layout_height="40dp"
            android:layout_centerVertical="true"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:background="@android:color/transparent"
            android:src="@drawable/photo_icon"
            android:scaleType="fitCenter"
            android:layout_marginLeft="15dp"
            android:id="@+id/photoView" />
        <com.app.general.textview.TextViewRegular
            android:layout_width="100dp"
            android:layout_height="50dp"
            android:text="300"
            android:layout_alignParentTop="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentEnd="true"
            android:gravity="center_vertical|center_horizontal"
            android:textSize="20sp"
            android:textColor="#267158"
            android:id="@+id/letters_counter" />

        <Button
            android:layout_width="60dp"
            android:layout_height="fill_parent"
            android:id="@+id/takePhoto"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:background="@android:color/transparent" />
    </RelativeLayout>

</RelativeLayout>

Manifest:

<activity
        android:name=".Test"
        android:label="@string/title_activity_test"
        android:windowSoftInputMode="adjustResize" >
    </activity>

The result is keyboard covering the bottom relative layout.

Upvotes: 3

Views: 712

Answers (1)

Dmitrii G.
Dmitrii G.

Reputation: 899

Bug in android. Happens while using translucent status bar. Solution is to add this attribute to parent layout:

android:fitsSystemWindows="true"

Upvotes: 1

Related Questions