zoukankan      html  css  js  c++  java
  • HorizontalScrollView实现先左滑动后右滑动动画

     1 @Override
     2     protected void onCreate(Bundle savedInstanceState) {
     3         super.onCreate(savedInstanceState);
     4         setContentView(R.layout.activity_main);
     5 
     6 HorizontalScrollView hsTabs = (HorizontalScrollView ) findViewById(R.id.hsTabs);
     7 
     8 new Handler().postDelayed(new Runnable() {
     9 
    10             @Override
    11             public void run() {
    12 
    13                 
    14                 
    15                 ObjectAnimator oa = ObjectAnimator.ofInt(hsTabs, "scrollX", 0, 150);
    16                 oa.setDuration(500);
    17                 
    18 
    19                 final ObjectAnimator oa2 = ObjectAnimator
    20                         .ofInt(hsTabs, "scrollX", 150, 0);
    21                 oa2.setDuration(500);
    22 
    23                 oa.addListener(new AnimatorListener() {
    24 
    25                     @Override
    26                     public void onAnimationStart(Animator arg0) {
    27 
    28                     }
    29 
    30                     @Override
    31                     public void onAnimationRepeat(Animator arg0) {
    32 
    33                     }
    34 
    35                     @Override
    36                     public void onAnimationEnd(Animator arg0) {
    37                         oa2.start();
    38 
    39                     }
    40 
    41                     @Override
    42                     public void onAnimationCancel(Animator arg0) {
    43 
    44                     }
    45                 });
    46 
    47                 oa.start();
    48 
    49             }
    50         }, 1000);
    51 }
  • 相关阅读:
    多线程下载
    jsoup 的简单应用
    DBUtils基本使用
    BeanUtils简单应用
    POI 生成exel报表
    java使用iText生成pdf表格
    solr开发 小案例
    iOS collectionView返回顶部 / 滚动到指定位置
    OC block
    OC 添加GCD 定时器
  • 原文地址:https://www.cnblogs.com/l2rf/p/4097183.html
Copyright © 2011-2022 走看看