android.view.View.setAnimation()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(224)

本文整理了Java中android.view.View.setAnimation()方法的一些代码示例,展示了View.setAnimation()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。View.setAnimation()方法的具体详情如下:
包路径:android.view.View
类名称:View
方法名:setAnimation

View.setAnimation介绍

暂无

代码示例

代码示例来源:origin: commonsguy/cw-omnibus

private AnimatorProxy(View view) {
  setDuration(0); //perform transformation immediately
  setFillAfter(true); //persist transformation beyond duration
  view.setAnimation(this);
  mView = new WeakReference<View>(view);
}

代码示例来源:origin: jeasonlzy/ImagePicker

/**
   * 单击时,隐藏头和尾
   */
  @Override
  public void onImageSingleTap() {
    if (topBar.getVisibility() == View.VISIBLE) {
      topBar.setAnimation(AnimationUtils.loadAnimation(this, R.anim.top_out));
      bottomBar.setAnimation(AnimationUtils.loadAnimation(this, R.anim.fade_out));
      topBar.setVisibility(View.GONE);
      bottomBar.setVisibility(View.GONE);
      tintManager.setStatusBarTintResource(Color.TRANSPARENT);//通知栏所需颜色
      //给最外层布局加上这个属性表示,Activity全屏显示,且状态栏被隐藏覆盖掉。
//            if (Build.VERSION.SDK_INT >= 16) content.setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN);
    } else {
      topBar.setAnimation(AnimationUtils.loadAnimation(this, R.anim.top_in));
      bottomBar.setAnimation(AnimationUtils.loadAnimation(this, R.anim.fade_in));
      topBar.setVisibility(View.VISIBLE);
      bottomBar.setVisibility(View.VISIBLE);
      tintManager.setStatusBarTintResource(R.color.ip_color_primary_dark);//通知栏所需颜色
      //Activity全屏显示,但状态栏不会被隐藏覆盖,状态栏依然可见,Activity顶端布局部分会被状态遮住
//            if (Build.VERSION.SDK_INT >= 16) content.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
    }
  }
}

代码示例来源:origin: jeasonlzy/ImagePicker

/** 单击时,隐藏头和尾 */
  @Override
  public void onImageSingleTap() {
    if (topBar.getVisibility() == View.VISIBLE) {
      topBar.setAnimation(AnimationUtils.loadAnimation(this, com.lzy.imagepicker.R.anim.top_out));
      topBar.setVisibility(View.GONE);
      tintManager.setStatusBarTintResource(Color.TRANSPARENT);//通知栏所需颜色
      //给最外层布局加上这个属性表示,Activity全屏显示,且状态栏被隐藏覆盖掉。
//            if (Build.VERSION.SDK_INT >= 16) content.setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN);
    } else {
      topBar.setAnimation(AnimationUtils.loadAnimation(this, com.lzy.imagepicker.R.anim.top_in));
      topBar.setVisibility(View.VISIBLE);
      tintManager.setStatusBarTintResource(R.color.ip_color_primary_dark);//通知栏所需颜色
      //Activity全屏显示,但状态栏不会被隐藏覆盖,状态栏依然可见,Activity顶端布局部分会被状态遮住
//            if (Build.VERSION.SDK_INT >= 16) content.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
    }
  }
}

代码示例来源:origin: dongjunkun/DropDownMenu

/**
 * 关闭菜单
 */
public void closeMenu() {
  if (current_tab_position != -1) {
    ((TextView) tabMenuView.getChildAt(current_tab_position)).setTextColor(textUnselectedColor);
    ((TextView) tabMenuView.getChildAt(current_tab_position)).setCompoundDrawablesWithIntrinsicBounds(null, null,
        getResources().getDrawable(menuUnselectedIcon), null);
    popupMenuViews.setVisibility(View.GONE);
    popupMenuViews.setAnimation(AnimationUtils.loadAnimation(getContext(), R.anim.dd_menu_out));
    maskView.setVisibility(GONE);
    maskView.setAnimation(AnimationUtils.loadAnimation(getContext(), R.anim.dd_mask_out));
    current_tab_position = -1;
  }
}

代码示例来源:origin: ankidroid/Anki-Android

protected void enableViewAnimation(View view, Animation animation) {
  if (animationDisabled()) {
    disableViewAnimation(view);
  } else {
    view.setAnimation(animation);
  }
}

代码示例来源:origin: robolectric/robolectric

@Implementation
protected void setAnimation(final Animation animation) {
 directly().setAnimation(animation);
 if (animation != null) {
  new AnimationRunner(animation);
 }
}

代码示例来源:origin: dongjunkun/DropDownMenu

popupMenuViews.setAnimation(AnimationUtils.loadAnimation(getContext(), R.anim.dd_menu_in));
  maskView.setVisibility(VISIBLE);
  maskView.setAnimation(AnimationUtils.loadAnimation(getContext(), R.anim.dd_mask_in));
  popupMenuViews.getChildAt(i / 2).setVisibility(View.VISIBLE);
} else {

代码示例来源:origin: robolectric/robolectric

@Test
public void shouldSetAnimation() throws Exception {
 Animation anim = new TestAnimation();
 view.setAnimation(anim);
 assertThat(view.getAnimation()).isSameAs(anim);
}

代码示例来源:origin: Piasy/BigImageViewer

set.addAnimation(animation);
if (mThumbnailView != null) {
  mThumbnailView.setAnimation(set);
  mProgressIndicatorView.setAnimation(set);

代码示例来源:origin: stackoverflow.com

getTabHost().setOnTabChangedListener(new OnTabChangeListener() {
   public void onTabChanged(String tabId)
   {
      View currentView = getTabHost().getCurrentView();
      if (getTabHost().getCurrentTab() > currentTab)
      {
        currentView.setAnimation( inFromRightAnimation() );
      }
      else
      {
        currentView.setAnimation( outToRightAnimation() );
      }

      currentTab = getTabHost().getCurrentTab();
   }
});

代码示例来源:origin: stackoverflow.com

/*
* start animation (any view)
*/
private void startAnimation(View v, int resId, Boolean nextPuzzleOnEnd){
 Animation anim;
 if(v!=null){    // can be null, after change of orientation
     anim = AnimationUtils.loadAnimation(this.getContext(),resId);
     anim.setFillAfter(false);
     v.setAnimation(anim);
     if( nextPuzzleOnEnd ){
       anim.setAnimationListener(new AnimationListener() {
         public void onAnimationStart(Animation anim)
         {
         };
         public void onAnimationRepeat(Animation anim)
         {
         };
         public void onAnimationEnd(Animation anim)
         {
           nextPuzzle();
         };
       });                     
     }
     v.startAnimation(anim);                 
 }
}

代码示例来源:origin: Rogero0o/CatLoadingView

@Override
public void onResume() {
  super.onResume();
  mouse.setAnimation(operatingAnim);
  eye_left.setAnimation(eye_left_Anim);
  eye_right.setAnimation(eye_right_Anim);
  eyelid_left.startLoading();
  eyelid_right.startLoading();
  mGraduallyTextView.startLoading();
}

代码示例来源:origin: com.nineoldandroids/library

private AnimatorProxy(View view) {
  setDuration(0); //perform transformation immediately
  setFillAfter(true); //persist transformation beyond duration
  view.setAnimation(this);
  mView = new WeakReference<View>(view);
}

代码示例来源:origin: stackoverflow.com

} else if (animation != null) {
  animation.cancel();
  view.setAnimation(null);

代码示例来源:origin: stackoverflow.com

View tv = ...
Animation a = new FadeUpAnimation(tv);
a.setInterpolator(new AccelerateInterpolator());
a.setDuration(300);
tv.setAnimation(a);
tv.startAnimation(a);

代码示例来源:origin: AppLozic/Applozic-Android-SDK

public static ApplozicAudioRecordAnimation wrap(View view) {
  ApplozicAudioRecordAnimation proxy = PROXIES.get(view);
  Animation animation = view.getAnimation();
  if (proxy == null || proxy != animation && animation != null) {
    proxy = new ApplozicAudioRecordAnimation(view);
    PROXIES.put(view, proxy);
  } else if (animation == null) {
    view.setAnimation(proxy);
  }
  return proxy;
}

代码示例来源:origin: stackoverflow.com

for (final View coachmarkView : coachmarkViews) {
 Animation animation = coachmarkView.getAnimation();
 if (animation != null) {
  animation.cancel();
  coachmarkView.setAnimation(null);
 }
 coachmarkView.setVisibility(View.INVISIBLE);
}

代码示例来源:origin: Android500/AwesomeDrawer

private AnimatorProxy(View view) {
  setDuration(0); //perform transformation immediately
  setFillAfter(true); //persist transformation beyond duration
  view.setAnimation(this);
  mView = new WeakReference<View>(view);
}

代码示例来源:origin: AppLozic/Applozic-Android-SDK

private ApplozicAudioRecordAnimation(View view) {
  setDuration(0);
  setFillAfter(true);
  view.setAnimation(this);
  mView = new WeakReference<View>(view);
}

代码示例来源:origin: Tencent/RapidView

public void run(RapidParserObject object, Object view, Var value) {
    Animation animation = object.getAnimationCenter().getTween(value.getString());
    if( animation == null ){
      return;
    }
    ((View)view).setAnimation(animation);
  }
}

相关文章

微信公众号

最新文章

更多

View类方法