Guest User

Untitled

a guest
Apr 22nd, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. LinearInterpolator scrollInterpolator = new LinearInterpolator();
  2. Scroller scroller = new Scroller(this,scrollInterpolator);
  3. scroller.extendDuration(10000);//I thought this was 10 seconds
  4. text1.setScroller(scroller);
  5.  
  6. scrollView.post(new Runnable() {
  7. @RequiresApi(api = Build.VERSION_CODES.HONEYCOMB)
  8. @Override
  9. public void run() {
  10. scrollView.fullScroll(ScrollView.FOCUS_DOWN);
  11.  
  12. }
  13. });
  14.  
  15. final ScrollView scrollView = findViewById(R.id.scrollView);
  16. scrollView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
  17. @Override
  18. public void onGlobalLayout() {
  19. scrollView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
  20. ObjectAnimator objectAnimator = ObjectAnimator.ofInt(scrollView,"scrollY",scrollView.getChildAt(0).getHeight()-scrollView.getHeight());
  21. objectAnimator.setDuration(10000);
  22. objectAnimator.setInterpolator(new LinearInterpolator());
  23. objectAnimator.start();
  24. }
  25. });
Add Comment
Please, Sign In to add comment