方法一
1、在***.xml布局文件中TextView的控件中添加:
android:scrollbars="vertical"
android:fadeScrollbars="false"
2、在java中的代码:
word_tv = findViewById(R.id.world_tv);// chat对应的文字描述
// 设置TextView可以滚动
word_tv.setMovementMethod(ScrollingMovementMethod.getInstance());
方法二
1、在***.xml布局文件中代码:
<ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="15dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/word_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:textColor="@color/colorBlack"
android:scrollbars="vertical"/>
</LinearLayout>
</ScrollView>
2、在java中的代码:
word_tv = findViewById(R.id.word_tv);