I wish to move smoothly to next scroll position in my custom view (on button press or event). How to implement this? First of all I can't see scroll animation class (only alpha, rotate, scale and translate). Secondly, having animation class, I can't see iterative one (say to scroll 100 pixels rights whatever position we have) only absolute ones (i.e. to animate from one constant value to another).
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
Animating scroll is done through a combination of using Scroller/OverScroller (to compute the time interpolated values of your scroll offsets), GestureDetectors (to start the scroller object) and the onComputeScroll method of a View (which implicitly is your animation loop).
The official android docs now have a detailed tutorial on precisely this topic. http://developer.android.com/training/gestures/scroll.html
Using ObjectAnimator, This is a sample for scrolling to top :
See the view_cache_demo sample code to see how to do animated scrolling. It works in 2D, caches complex drawing and also handles fling gestures, but you can simplify all that as necessary.
Assuming you are using a ScrollView, does smoothScrollTo(...) work for you?
http://developer.android.com/reference/android/widget/ScrollView.html#smoothScrollTo%28int,%20int%29