要在Android TextView中实现滚动效果,可以使用ScrollView或者使用TextView的setMovementMethod方法实现滚动效果。
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Your text here"
android:scrollbars="vertical"/>
</ScrollView>
TextView textView = findViewById(R.id.textView);
textView.setMovementMethod(new ScrollingMovementMethod());
这样就可以在TextView中实现滚动效果了。
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读:android怎么实现跑马灯效果