Android ScrollView Hidden Elements

1

I have an XML which adds a ScrollView if some device had a smaller screen, the problem comes in that by focusing on the last element of my edittexts the accept button which is always in BOTTOM true I cover my box where I am writing, I leave my xml

 <?xml version="1.0" encoding="utf-8"?>

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/white"
    android:fitsSystemWindows="true"
    >
    <android.support.design.widget.NavigationView
        android:id="@+id/nav_view"
        android:layout_width="330dp"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:fitsSystemWindows="true"
        app:headerLayout="@layout/nav_header_main"
        app:menu="@menu/activity_main_drawer"
        android:background="@color/white"
        app:itemIconTint="#000000" />
    <LinearLayout
        android:id="@+id/activity_activation_step1"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:focusable="true"
        android:focusableInTouchMode="true"
        android:orientation="vertical"
        android:gravity="center">
        <include layout="@layout/actionbar_toolbar"/>
        <ScrollView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:fillViewport="true">

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

                <ImageView
                    android:id="@+id/foto_galleryy"
                    android:layout_width="100dp"
                    android:layout_height="100dp"
                    android:layout_centerHorizontal="true"
                    android:layout_marginTop="15dp"
                    android:background="@mipmap/nopicture" />

                <ImageView
                    android:id="@+id/badge"
                    android:layout_width="30dp"
                    android:layout_height="30dp"
                    android:layout_alignBottom="@+id/foto_galleryy"
                    android:layout_alignRight="@+id/foto_galleryy"
                    android:background="@mipmap/cameraxxxhdpi"
                    android:onClick="LoadImage" />

                <TextView
                    android:id="@+id/NombrePersona"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_below="@+id/foto_galleryy"
                    android:layout_centerHorizontal="true"
                    android:layout_marginTop="20dp"
                    android:textColor="@color/black"
                    android:textSize="@dimen/T18" />

                <TextView
                    android:id="@+id/strtxtCellPhone"
                    android:layout_width="match_parent"
                    android:layout_height="25dp"
                    android:layout_below="@+id/NombrePersona"
                    android:layout_marginLeft="20dp"
                    android:layout_marginRight="20dp"
                    android:layout_marginTop="15dp"
                    android:enabled="false"
                    android:text="@string/strtxtCellPhone"
                    android:textColor="@color/BotonsHome"
                    android:textSize="@dimen/T16" />

                <EditText
                    android:id="@+id/strTxtCellPhoneInformations"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_below="@+id/strtxtCellPhone"
                    android:layout_marginLeft="20dp"
                    android:layout_marginRight="20dp"
                    android:textColor="@color/HintHomeMonto"
                    android:textSize="@dimen/T14" />

                <TextView
                    android:id="@+id/strtxtNroCuenta"
                    android:layout_width="match_parent"
                    android:layout_height="25dp"
                    android:layout_below="@+id/strTxtCellPhoneInformations"
                    android:layout_marginLeft="20dp"
                    android:layout_marginRight="20dp"
                    android:layout_marginTop="5dp"
                    android:enabled="false"
                    android:text="@string/NroCuenta"
                    android:textColor="@color/BotonsHome"
                    android:textSize="@dimen/T16" />

                <EditText
                    android:id="@+id/strTxtNroCuenta"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_below="@+id/strtxtNroCuenta"
                    android:layout_marginLeft="20dp"
                    android:layout_marginRight="20dp"
                    android:textColor="@color/HintHomeMonto"
                    android:textSize="@dimen/T14" />

                <TextView
                    android:id="@+id/strtxtEntidadFinanciera"
                    android:layout_width="match_parent"
                    android:layout_height="25dp"
                    android:layout_below="@+id/strTxtNroCuenta"
                    android:layout_marginLeft="20dp"
                    android:layout_marginRight="20dp"
                    android:layout_marginTop="5dp"
                    android:enabled="false"
                    android:text="@string/strTxtEntidadFinanciera"
                    android:textColor="@color/BotonsHome"
                    android:textSize="@dimen/T16" />

                <EditText
                    android:id="@+id/strEditEntidadFinanciera"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_below="@+id/strtxtEntidadFinanciera"
                    android:layout_marginLeft="20dp"
                    android:layout_marginRight="20dp"
                    android:textColor="@color/HintHomeMonto"
                    android:textSize="@dimen/T14" />

                <TextView
                    android:id="@+id/strtxtEmail"
                    android:layout_width="match_parent"
                    android:layout_height="25dp"
                    android:layout_below="@+id/strEditEntidadFinanciera"
                    android:layout_marginLeft="20dp"
                    android:layout_marginRight="20dp"
                    android:layout_marginTop="5dp"
                    android:text="@string/strtxtemail"
                    android:textColor="@color/BotonsHome"
                    android:textSize="@dimen/T16" />

                <EditText
                    android:id="@+id/strEditEmail"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_below="@+id/strtxtEmail"
                    android:layout_marginLeft="20dp"
                    android:layout_marginRight="20dp"
                    android:maxLength="35"
                    android:textColor="@color/HintHomeMonto"
                    android:textSize="@dimen/T14" />

                <Button
                    android:id="@+id/iconodeaceptar"
                    android:layout_width="match_parent"
                    android:layout_height="40dp"
                    android:layout_alignParentBottom="true"
                    android:layout_marginBottom="10dp"
                    android:layout_marginLeft="20dp"
                    android:layout_marginRight="20dp"
                    android:layout_marginTop="20dp"
                    android:background="@drawable/redondoazul"
                    android:onClick="guardarDatos"
                    android:text="Continuar"
                    android:textColor="@color/white" />
            </RelativeLayout>
        </ScrollView>
    </LinearLayout>
</android.support.v4.widget.DrawerLayout>

The first Image shows the whole form

When I select the last EditText

the scroll makes the button surpass the box leaving the hidden box I do not understand why this happens thanks already!

    
asked by Bruno Sosa Fast Tag 15.03.2018 в 18:11
source

2 answers

2

Try to put the value of your button instead of layout_alignParentBottom= false quitalo and do the following android:layout_below="@+id/strEditEmail so the button will be positioned below the edit text and not aligned to the bottom of your Layout Father that is why the button jumps to the make the last selection to the edittext.

The other thing that would be is to take the button out of the scroll view and align the scroll to the margin of the button

    
answered by 16.03.2018 / 17:58
source
0

Instead of defining on the button:

android:layout_alignParentBottom="true"

define that this button is below the EditText with id strEditEmail ,

 android:layout_below="@+id/strEditEmail"

in this way the button would always appear below:

            <Button
                android:id="@+id/iconodeaceptar"
                android:layout_width="match_parent"
                android:layout_height="40dp"

                android:layout_below="@+id/strEditEmail"

                android:layout_marginBottom="10dp"
                android:layout_marginLeft="20dp"
                android:layout_marginRight="20dp"
                android:layout_marginTop="20dp"
                android:background="@drawable/redondoazul"
                android:onClick="guardarDatos"
                android:text="Continuar"
                android:textColor="@color/white" />
    
answered by 16.03.2018 в 02:01