Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scrollview not scrolling completely in a Fragment, Android

I'm pretty new in android and I'm developing an app but I have an error that's driving me crazy. The thing is that it doesn't scroll completely, it leaves a button out of the screen so it cant be seen.

Here is the xml code:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#d3d3d3"
android:orientation="vertical">

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fillViewport="true"
    >

        <LinearLayout
            android:orientation="vertical"
            android:background="@drawable/bg_sugerir"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"
            android:id="@+id/linearLayout"
            >

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/imageView"
                android:src="@drawable/pd"
                android:layout_marginBottom="15dp"
                />

            <EditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:id="@+id/editText"
                android:layout_marginBottom="15dp"
                android:hint="Nombre" />

            <EditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:inputType="phone"
                android:ems="10"
                android:id="@+id/editText2"
                android:layout_marginBottom="15dp"
                android:hint="Teléfono" />

            <EditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:id="@+id/editText4"
                android:layout_marginBottom="15dp"
                android:hint="Provincia" />

            <EditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:id="@+id/editText3"
                android:layout_marginBottom="15dp"
                android:hint="Descripción" />

            <Button
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="Enviar"
                android:id="@+id/button" />


        </LinearLayout>
</ScrollView>
</LinearLayout>

It shows the following, but as shown, the button is not there: notScrolling

Hope anyone could help me, Thanks

like image 425
Joel Alvarez Myrrie Avatar asked Mar 26 '16 01:03

Joel Alvarez Myrrie


3 Answers

Try replacing the ScrollView with a android.support.v4.widget.NestedScrollView

like image 120
w9jds Avatar answered Sep 27 '22 16:09

w9jds


Make the ScrollView the root of your layout, instead of using the LinearLayout, or try to use android.support.v4.widget.NestedScrollView instead.

like image 23
Mauker Avatar answered Sep 27 '22 17:09

Mauker


try to add android:windowSoftInputMode="adjustResize" to your activity tag manifest file

like image 34
Anass Avatar answered Sep 27 '22 16:09

Anass