I try to scroll one whole screen size page in every mobile device on a long text within a TextView in a ScrollView but all I got is scrolling to the bottom of the whole Text which is like this:
binding.scrollView.post{
binding.scrollView.fullScroll(View.FOCUS_DOWN)
}
I want it scrolls page by page not the whole text. here is the XML code of the ScrollView:
<ScrollView
android:id="@+id/scroll_view"
android:layout_width="match_parent"
android:layout_height="0dp"
android:fillViewport="true"
android:paddingBottom="24dp"
android:background="@color/whitef5_background"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/holder_player_bar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/img"
android:layout_width="match_parent"
android:layout_height="220dp"
android:layout_marginHorizontal="16dp"
android:scaleType="centerCrop"
android:layout_marginTop="24dp"
android:src="@drawable/placeholder"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:riv_corner_radius="8dp"/>
<TextView
android:id="@+id/txt_title"
style="@style/TextBold16Black2128"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColorLink="@color/app_orange"
android:layout_marginTop="12dp"
android:gravity="center"
android:layout_marginHorizontal="16dp"
android:text="Reading Title"
app:layout_constraintTop_toBottomOf="@id/img"/>
<TextView
android:id="@+id/txt_title_fa"
style="@style/TextMed14Gray8f"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginHorizontal="16dp"
android:text="مطلب ساختگی"
app:layout_constraintTop_toBottomOf="@id/txt_title"
android:layout_marginTop="12dp"/>
<View
android:id="@+id/div"
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_marginTop="12dp"
android:layout_marginHorizontal="16dp"
android:background="@color/grayDBEC"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/txt_title_fa"/>
<TextView
android:id="@+id/txt"
style="@style/TextMed14Black2128"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp"
android:text="@string/reading_test_speech"
app:layout_constraintTop_toBottomOf="@id/div"
android:layout_marginTop="24dp"/>
<Button
android:id="@+id/btn_test"
style="@style/ButtonMed14White"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp"
android:layout_marginBottom="24dp"
android:background="@drawable/selector_orange_button"
android:text="@string/reading_go_to_questions_btn_text"
app:layout_constraintTop_toBottomOf="@id/txt"
android:layout_marginTop="24dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintVertical_bias="1.0" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
if there's a method or if I need to change or note something please update me with it so I can have the right function. thank you.