不需嵌套ScrollView就可以滚动TextView的方法
需要同时设置如下2个属性,这样就不需要使用传统嵌套ScrollView方法,即使文本内容特别长
- textView.movementMethod = ScrollingMovementMethod.getInstance()
- android:scrollbars=“vertical”
tv_answer.movementMethod = ScrollingMovementMethod.getInstance()
<TextView
android:id="@+id/tv_question"
android:scrollbars="vertical"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintHeight_percent="0.45"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/path_info"
app:layout_constraintBottom_toTopOf="@+id/tv_answer"
android:gravity="center"
android:textColor="@android:color/white"
android:background="@android:color/background_dark"/>