I would like to add the smooth scrolling functionality into my application. i.e. I have a huge text and I want to scroll it automatically (like in book readers).
Could anyone offer any examples of smooth scrolling?
Just put the view(s) you want to scroll inside a ScrollView. So to put some text in a scrolling area, put the text in a TextView, and then the TextView inside a ScrollView, like this:
<ScrollView android:layout_width="fill_parent" android:layout_height="fill_parent" > <TextView android:id="@+id/my_view_id" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </ScrollView> Use reflection to update the ScrollView's Scroller:
Field mScroller; mScroller = ScrollView.class.getDeclaredField("mScroller"); mScroller.setAccessible(true); CustomScroller scroller = new CustomScroller(getContext(), new AccelerateInterpolator()); mScroller.set(this, scroller); Use smoothScrollTo method (may have to setSmoothScrolligEnabled(true))