I am encountering an issue with the layout of an activity, where the content is not scrolling as intended. Currently, I have a Scrollview implemented within a ConstraintLayout, with a LinearLayout nested inside it. Despite attempting several approaches to resolve this problem, I have been unsuccessful in achieving the desired scrolling behavior.
At this point, I am seeking guidance and assistance in identifying a suitable solution for this issue. I have also experimented with placing the Scrollview within a LinearLayout, but unfortunately, this alternative approach did not yield the desired results either.
I would greatly appreciate any insights, recommendations, or assistance that can be provided to help address this matter effectively. Thank you for your attention and support!
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:background="@android:color/white" >
<ImageButton
android:id="@+id/moreImageButton"
android:layout_width="47dp"
android:layout_height="50dp"
android:layout_centerHorizontal="true"
android:layout_gravity="center"
android:background="#FFFFFF"
android:clickable="true"
android:minWidth="36dp"
android:minHeight="36dp"
android:src="@drawable/ic_menu_bar_black"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageButton
android:id="@+id/imagebut"
android:layout_width="49dp"
android:layout_height="45dp"
android:layout_centerHorizontal="true"
android:layout_gravity="center"
android:background="#FFFFFF"
android:clickable="true"
android:minWidth="36dp"
android:minHeight="36dp"
android:src="@drawable/ic_icons8_plus"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TableRow
android:id="@+id/hr2"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#444"
app:layout_constraintTop_toBottomOf="@+id/imagebut"
></TableRow>
<TextView
android:id="@+id/name_schedule"
android:layout_width="411dp"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:background="#FFFFFF"
android:fontFamily="serif"
android:text="Schedule"
android:textAlignment="viewStart"
android:textColor="#000000"
android:textSize="25sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/hr2" />
<TableRow
android:id="@+id/hr1"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#444"
app:layout_constraintTop_toBottomOf="@+id/name_schedule"
></TableRow>
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_marginTop="10dp"
android:animateLayoutChanges="true"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/hr1">
<LinearLayout
android:id="@+id/lly"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="true"
android:scrollbars="vertical"
android:orientation="vertical">
<TextView
android:id="@+id/textView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/white"
android:fontFamily="serif"
android:text="Monday"
android:textColor="#000000"
android:textSize="20sp" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView_M"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/textView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/white"
android:fontFamily="serif"
android:text="Tuesday"
android:textColor="#000000"
android:textSize="20sp" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView_T"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/textView3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/white"
android:fontFamily="serif"
android:text="Wednesday"
android:textColor="#000000"
android:textSize="20sp" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView_W"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/textView4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/white"
android:fontFamily="serif"
android:text="Thursday"
android:textColor="#000000"
android:textSize="20sp"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView_TH"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/textView5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/white"
android:fontFamily="serif"
android:text="Friday"
android:textColor="#000000"
android:textSize="20sp"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView_F"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/textView6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/white"
android:fontFamily="serif"
android:text="Saturday"
android:textColor="#000000"
android:textSize="20sp"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView_S"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/textView7"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/white"
android:fontFamily="serif"
android:text="Sunday"
android:textColor="#000000"
android:textSize="20sp"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView_SU"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
It is because scroller is as big as its child, the LinearLayout
. Therefore, there is no need for the scroller to scroll. Try giving your scroller a definite height i.e. 500dp. Finally, the LinearLayout
should be:
<LinearLayout
android:id="@+id/lly"
android:layout_width="match_parent"
android:layout_height="wrap_content"
...
>