Android - Align Layout above keyboard

2

I have the following layout:

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/view_login"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/background"
    tools:context=".LoginActivity">

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:paddingBottom="50dp"
            android:paddingTop="50dp">

            <ImageView
                android:id="@+id/marca"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentTop="true"
                android:layout_centerHorizontal="true"
                android:layout_marginBottom="50dp"
                android:background="@drawable/marca" />

            <LinearLayout
                android:layout_below="@+id/marca"
                android:id="@+id/form_login"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true"
                android:layout_marginBottom="50dp"
                android:layout_marginLeft="20dp"
                android:layout_marginRight="20dp"
                android:orientation="vertical">

                <ImageView style="@style/separador" />

                <LinearLayout style="@style/box_field">

                    <ImageView
                        style="@style/icon_field"
                        android:background="@drawable/icon_usuario" />

                    <EditText
                        android:id="@+id/usuario"
                        style="@style/edit_field"
                        android:hint="@string/hint_usuario"
                        android:inputType="textNoSuggestions"/>
                </LinearLayout>

                <ImageView style="@style/separador" />

                <LinearLayout style="@style/box_field">

                    <ImageView
                        style="@style/icon_field"
                        android:background="@drawable/icon_senha" />

                    <EditText
                        android:id="@+id/senha"
                        style="@style/edit_field"
                        android:hint="@string/hint_senha"
                        android:inputType="textPassword"
                        android:imeOptions="actionSend"/>
                </LinearLayout>

                <ImageView style="@style/separador" />

                <RelativeLayout
                    android:id="@+id/botao_entrar"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="40dp"
                    android:background="#009999">

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_centerInParent="true"
                        android:paddingBottom="20dp"
                        android:paddingTop="20dp"
                        android:text="@string/Entrar"
                        android:textColor="#cccccc"
                        android:textSize="16sp" />

                </RelativeLayout>

            </LinearLayout>

        </RelativeLayout>
    </ScrollView>

    <RelativeLayout
        android:id="@+id/msg_login"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:layout_alignParentBottom="true"
        android:gravity="bottom"
        android:visibility="invisible">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="10dp"
            android:background="#FFFFFF"
            android:paddingBottom="5dp"
            android:paddingLeft="10dp"
            android:paddingRight="10dp"
            android:paddingTop="5dp">

            <TextView
                android:id="@+id/txt_msg_login"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true"
                android:textColor="#233246" />
        </RelativeLayout>
    </RelativeLayout>
</RelativeLayout>

My manifest looks like this:

    <activity
        android:name=".LoginActivity"
        android:label="@string/app_name"
        android:screenOrientation="portrait"
        android:windowSoftInputMode="adjustResize">
    </activity>

What I need is the following when opening the keyboard, my screen resizes, that is, this entire layout is above the keyboard. Does anyone know of any way to do this?

    
asked by anonymous 10.09.2015 / 12:56

1 answer

1

try to put this

<activity
        android:name=".activities.MainActivity"
        android:windowSoftInputMode="adjustResize|adjustPan">
<activity/>
    
10.09.2015 / 15:19