如果想要设置TextView
在滚动时的滚动范围,可以使用ScrollView
来包裹TextView
,然后在ScrollView
中设置滚动范围。
示例代码如下:
<ScrollView
android:layout_width="match_parent"
android:layout_height="200dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Your text here"
android:scrollbars="vertical"/>
</ScrollView>
在上面的示例代码中,ScrollView
的高度被设置为200dp
,这样TextView
中的文本内容超过200dp
时就会出现垂直滚动条,用户可以通过滚动条来滚动查看文本内容。你可以根据需要调整ScrollView
的高度来设置滚动范围。
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读:Android TextView滚动时如何显示滚动条