Keyboard does not overlay button in Relative Layout

0

Good morning everyone. I have a problem with my application: I have a device registration screen, as shown below, but when I enable a typing field, the keyboard does not override the button:

WhatleftmemostdoubtfulisthatIhaveanotherlayoutwherethisdoesnotoccur:

Bothbuttonshavethesameencoding:

RECORDBUTTONDEVICE

<Buttonandroid:id="@+id/btn_gravaDisp"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_marginBottom="20dp"
    android:layout_marginRight="20dp"
    android:layout_marginLeft="20dp"
    android:text="Gravar Dispositivo"
    android:background="@color/colorPrimaryDark"
    android:textColor="@android:color/white"
    android:textAppearance="@style/Base.TextAppearance.AppCompat.Large"/>

USER RECORD BUTTON

<Button
    android:id="@+id/btn_gravaUser"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_marginBottom="20dp"
    android:layout_marginRight="20dp"
    android:layout_marginLeft="20dp"
    android:text="Gravar Usuário"
    android:background="@color/colorPrimaryDark"
    android:textColor="@android:color/white"
    android:textAppearance="@style/Base.TextAppearance.AppCompat.Large"/>

I've checked in some other posts that there is a adjustPan option, however, both of these classes extend Fragment , not AppCompatActivity .

Below, java code for both classes:

Register Device:

public class CadastrarDispositivos extends Fragment {


@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    getActivity().setTitle("Cadastro de Dispositivos");
}

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup 
container, @Nullable Bundle savedInstanceState) {
    return inflater.inflate(R.layout.cadastrodispositivos, container, 
false);
}

}

Users:

public class Usuarios extends Fragment {


@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    getActivity().setTitle("Usuários");
}

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup 
container, @Nullable Bundle savedInstanceState) {
    return inflater.inflate(R.layout.usuarios, container, false);
}

}

Device Master Xml:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent"
android:layout_height="match_parent">

<android.support.design.widget.TextInputLayout
    android:id="@+id/inputNomeDisp"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:paddingTop="20dp">
    <android.support.design.widget.TextInputEditText
        android:id="@+id/editNomeDisp"
        android:hint="Nome do dispositivo"
        android:textColorHint="@color/colorPrimaryDark"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_margin="20dp"
        android:maxLength="20"
        android:inputType="text"/>
</android.support.design.widget.TextInputLayout>

<android.support.design.widget.TextInputLayout
    android:layout_below="@id/inputNomeDisp"
    android:id="@+id/inputTipoDisp"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
    <android.support.design.widget.TextInputEditText
        android:id="@+id/editTipoDisp"
        android:layout_width="match_parent"
        android:hint="Tipo do dispositivo"
        android:textColorHint="@color/colorPrimaryDark"
        android:layout_height="match_parent"
        android:layout_margin="20dp"
        android:maxLength="20"
        android:inputType="text"/>
</android.support.design.widget.TextInputLayout>

<android.support.design.widget.TextInputLayout
    android:layout_below="@id/inputTipoDisp"
    android:id="@+id/inputLocalDisp"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
    <android.support.design.widget.TextInputEditText
        android:id="@+id/editLocalDisp"
        android:layout_width="match_parent"
        android:hint="Local do dispositivo"
        android:textColorHint="@color/colorPrimaryDark"
        android:layout_height="match_parent"
        android:layout_margin="20dp"
        android:maxLength="20"
        android:inputType="text"/>
</android.support.design.widget.TextInputLayout>

<android.support.design.widget.TextInputLayout
    android:layout_below="@id/inputLocalDisp"
    android:id="@+id/inputPortaDisp"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
    <android.support.design.widget.TextInputEditText
        android:id="@+id/editPortaDisp"
        android:layout_width="match_parent"
        android:hint="Porta do dispositivo"
        android:textColorHint="@color/colorPrimaryDark"
        android:layout_height="match_parent"
        android:layout_margin="20dp"
        android:maxLength="20"
        android:inputType="number"/>
</android.support.design.widget.TextInputLayout>

<Button
    android:id="@+id/btn_gravaDisp"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_marginBottom="20dp"
    android:layout_marginRight="20dp"
    android:layout_marginLeft="20dp"
    android:text="Gravar Dispositivo"
    android:background="@color/colorPrimaryDark"
    android:textColor="@android:color/white"
    android:textAppearance="@style/Base.TextAppearance.AppCompat.Large"/ 
</RelativeLayout>

User registration Xml:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent"
android:layout_height="match_parent">

<android.support.design.widget.TextInputLayout
android:id="@+id/inputNomeUsuario"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="20dp">
    <android.support.design.widget.TextInputEditText
        android:id="@+id/editNomeUsuario"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="20dp"
        android:hint="Nome do usuario"
        android:textColorHint="@color/colorPrimaryDark"/>
</android.support.design.widget.TextInputLayout>

<android.support.design.widget.TextInputLayout
    android:id="@+id/inputSenhaUsuario"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/inputNomeUsuario">
    <android.support.design.widget.TextInputEditText
        android:id="@+id/editSenhaUsuario"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="20dp"
        android:hint="Senha do usuario"
        android:textColorHint="@color/colorPrimaryDark"/>
</android.support.design.widget.TextInputLayout>

<android.support.v7.widget.AppCompatTextView
    android:layout_below="@id/inputSenhaUsuario"
    android:id="@+id/txtAdministrador"
    android:layout_margin="20dp"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="Administrador?"
    android:textSize="20dp"
    android:textColor="@color/colorPrimaryDark"/>

<android.support.v7.widget.AppCompatCheckBox
    android:id="@+id/cbx_Sim"
    android:text="Sim"
    android:textSize="20dp"
    android:textColor="@color/colorPrimaryDark"
    android:layout_below="@id/txtAdministrador"
    android:layout_marginLeft="20dp"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />

<android.support.v7.widget.AppCompatCheckBox
    android:id="@+id/cbx_Nao"
    android:text="Não"
    android:textSize="20dp"
    android:textColor="@color/colorPrimaryDark"
    android:layout_below="@id/cbx_Sim"
    android:layout_marginLeft="20dp"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />

<Button
    android:id="@+id/btn_gravaUser"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_marginBottom="20dp"
    android:layout_marginRight="20dp"
    android:layout_marginLeft="20dp"
    android:text="Gravar Usuário"
    android:background="@color/colorPrimaryDark"
    android:textColor="@android:color/white"
    android:textAppearance="@style/Base.TextAppearance.AppCompat.Large"/>

</RelativeLayout>

Thank you in advance for helping me!

Thanks!

    
asked by anonymous 30.04.2018 / 16:53

1 answer

0

By all means, what is making the button not overlap is the layout_alignParentBottom="true" item. What it does is literally align the view (in the case of the button) with the end of the layout, so that when the keyboard appears, the button will "go up" along with the end of the Layout instead of being overlapped. >

One of the two buttons is being overlapped because this option is being ignored. Try changing both to "false" and swap one by one to see the results.

    
30.04.2018 / 17:35