Very simple, do not use TextView directly within ScrollView, but add a layer of LinearLayout in the middle, can be the perfect solution.
<ScrollView android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginTop="15dp" android:layout_weight="1" android:background="@drawable/password_input_text_bg" app:layout_constraintBottom_toTopOf="@id/bottom" app:layout_constraintTop_toTopOf="parent" app:layout_constraintVertical_weight="1"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <TextView android:id="@+id/console" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginVertical="15dp" app:layout_constraintBottom_toTopOf="@id/bottom" /> </LinearLayout> </ScrollView>