Steve Steve - 1 month ago 15
Android Question

Scrolling a scroll view in android studio

I am developing a small android app that uses a

ScrollView
. I have a
RelativeLayout
in the
ScrollView
that I have already filled with items. Now I would like to scroll down to create more room to add more items, but Android Studio is not letting me do that, even though the scroll bar of the scroll view is visible. Is there a way to do that?

Here is the xml code, though I like working in the design view:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_new_reminder"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="0dp"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:paddingTop="0dp"
tools:context="com.steveops.locationreminder.NewReminderActivity">

<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="700dp"
android:padding="5dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="11dp"
android:layout_marginStart="11dp">

<TextView
android:text="REMINDER NAME"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView" />

<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:text="Name"
android:ems="10"
android:id="@+id/editText2"
android:layout_below="@+id/textView"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />

<TextView
android:text="ACTIVATE ON"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView5"
android:layout_below="@+id/editText2"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />

<CheckBox
android:text="M"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/textView5"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:id="@+id/checkBox7" />

<CheckBox
android:text="T"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/textView5"
android:layout_toRightOf="@+id/checkBox7"
android:layout_toEndOf="@+id/checkBox7"
android:id="@+id/checkBox8" />

<CheckBox
android:text="W"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/checkBox8"
android:layout_toRightOf="@+id/checkBox8"
android:layout_toEndOf="@+id/checkBox8"
android:id="@+id/checkBox9" />

<CheckBox
android:text="T"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/checkBox9"
android:layout_toRightOf="@+id/checkBox9"
android:layout_toEndOf="@+id/checkBox9"
android:id="@+id/checkBox10" />

<CheckBox
android:text="F"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/checkBox10"
android:layout_toRightOf="@+id/checkBox10"
android:layout_toEndOf="@+id/checkBox10"
android:id="@+id/checkBox11" />

<CheckBox
android:text="S"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/checkBox11"
android:layout_toRightOf="@+id/checkBox11"
android:layout_toEndOf="@+id/checkBox11"
android:id="@+id/checkBox12" />

<CheckBox
android:text="S"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/checkBox12"
android:layout_toRightOf="@+id/checkBox12"
android:layout_toEndOf="@+id/checkBox12"
android:id="@+id/checkBox13" />

<TextView
android:text="BETWEEN"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView7"
android:layout_below="@+id/checkBox7"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />

<TimePicker
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/timePicker"
android:layout_below="@+id/textView7"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_toStartOf="@+id/checkBox12"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />

</RelativeLayout>
</ScrollView>

</RelativeLayout>


As you can see in the screenshot, the scroll bar of the
ScrollView
is visible, but I am not able to scroll down to create enough space to add, for example, a new time picker. I hope I am making sense.

Answer

Found the solution, though I don't why it worked. I changed the selected device in the editor to a custom one and it just started working. I want to think that my editor was somehow frozen, that's why it wasn't scrolling.

I have never developed an app that exceeds the screen size thus the struggle.

Thank you all for trying to help, your responses are highly appreciated.

Comments