Using RelativeLayout inside ScrollView doesn't work when scrolling

I am trying to scroll through my relative layout. I added scrolling as a parent, but when I tilt the phone or emulator horizontally, it doesn't scroll.

I tried several different solutions, but none of them seem to work. Some of them include: No scroll in scrollview , ScrollView not Working - Relative layout and RelativeLayout with scroll without scroll

The code is as follows:

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

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/ScrollView01"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" 
    android:fillViewport="true"
    android:scrollbars="none">
<RelativeLayout

    android:layout_width="fill_parent"
    android:layout_height="fill_parent" 
    android:orientation="vertical">

        <Button
            android:layout_width="200dp" 
            android:id="@+id/register_button"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_centerHorizontal="true"
            android:text="Register" />

        <EditText
            android:id="@+id/email2"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_above="@+id/register_button"
            android:layout_alignLeft="@+id/register_button"
            android:layout_alignRight="@+id/register_button"
            android:hint="Re-Enter Email"
            android:inputType="textEmailAddress" />

        <EditText
            android:id="@+id/email1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_above="@+id/email2"
            android:layout_alignLeft="@+id/email2"
            android:layout_alignRight="@+id/email2"
            android:hint="Email"
            android:inputType="textEmailAddress" />

        <EditText
            android:id="@+id/password2"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_above="@+id/email1"
            android:layout_alignLeft="@+id/email1"
            android:layout_alignRight="@+id/email1"
            android:hint="Repeat Password"
            android:inputType="textPassword" />

        <EditText
            android:id="@+id/password1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_above="@+id/password2"
            android:layout_alignLeft="@+id/password2"
            android:layout_alignRight="@+id/password2"
            android:hint="Password"
            android:inputType="textPassword" />

        <EditText
            android:id="@+id/lastName"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_above="@+id/password1"
            android:layout_alignLeft="@+id/password1"
            android:layout_alignRight="@+id/password1"
            android:hint="Last Name"
            android:imeOptions="actionNext"
            android:inputType="textPersonName" />

        <EditText
            android:id="@+id/firstName"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_above="@+id/lastName"
            android:layout_alignLeft="@+id/lastName"
            android:layout_alignRight="@+id/lastName"
            android:hint="First Name"
            android:imeOptions="actionNext"
            android:inputType="textPersonName" />

        <EditText
            android:id="@+id/userName"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_above="@+id/firstName"
            android:layout_alignLeft="@+id/firstName"
            android:layout_alignRight="@+id/firstName"
            android:hint="Username"
            android:imeOptions="actionNext"
            android:inputType="textPersonName" />




</RelativeLayout>
</ScrollView>

Thank!

+5
source share
2 answers

RelativeLayout fill_parent. , ScrollView, . wrap_content , .

+3

android:fillViewport="true"

:)

0

All Articles