这是使TextView可滚动的默认方式: -
TextView txtView = (TextView)findViewById(R.id.book_detail);
txtView.setMovementMethod(new ScrollingMovementMethod());
txtView.setText("someLongStringHere");
但是我认为这不能正常工作,当手指离开屏幕时,它会停止滚动,这不能说用户友好的设计。
有没有办法让它以良好的方式进行? 就像我们在iOS verocity滚动中一样。
答案 0 :(得分:3)
使用此功能。
<ScrollView
android:id="@+id/myScrollview"
android:layout_width="match_parent"
android:layout_height="250dp"">
<TextView
android:id="@+id/myTextview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/longString" />
</ScrollView>