android.widget.ImageView.animate()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(8.5k)|赞(0)|评价(0)|浏览(219)

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

ImageView.animate介绍

暂无

代码示例

代码示例来源:origin: scwang90/SmartRefreshLayout

@Override
public void onStateChanged(@NonNull RefreshLayout refreshLayout, @NonNull RefreshState oldState, @NonNull RefreshState newState) {
  switch (newState) {
    case None:
    case PullDownToRefresh:
      mHeaderText.setText("下拉开始刷新");
      mArrowView.setVisibility(VISIBLE);//显示下拉箭头
      mProgressView.setVisibility(GONE);//隐藏动画
      mArrowView.animate().rotation(0);//还原箭头方向
      break;
    case Refreshing:
      mHeaderText.setText("正在刷新");
      mProgressView.setVisibility(VISIBLE);//显示加载动画
      mArrowView.setVisibility(GONE);//隐藏箭头
      break;
    case ReleaseToRefresh:
      mHeaderText.setText("释放立即刷新");
      mArrowView.animate().rotation(180);//显示箭头改为朝上
      break;
  }
}

代码示例来源:origin: frogermcs/InstaMaterial

private void animateUserProfileHeader() {
      vUserProfileRoot.setTranslationY(-vUserProfileRoot.getHeight());
      ivUserProfilePhoto.setTranslationY(-ivUserProfilePhoto.getHeight());
      vUserDetails.setTranslationY(-vUserDetails.getHeight());
      vUserStats.setAlpha(0);

      vUserProfileRoot.animate().translationY(0).setDuration(300).setInterpolator(INTERPOLATOR);
      ivUserProfilePhoto.animate().translationY(0).setDuration(300).setStartDelay(100).setInterpolator(INTERPOLATOR);
      vUserDetails.animate().translationY(0).setDuration(300).setStartDelay(200).setInterpolator(INTERPOLATOR);
      vUserStats.animate().alpha(1).setDuration(200).setStartDelay(400).setInterpolator(INTERPOLATOR).start();
  }
}

代码示例来源:origin: frogermcs/InstaMaterial

@Override
public void onSuccess() {
  ivPhoto.animate()
      .scaleX(1.f).scaleY(1.f)
      .setInterpolator(new OvershootInterpolator())
      .setDuration(400)
      .setStartDelay(200)
      .start();
}

代码示例来源:origin: HotBitmapGG/bilibili-android-client

footViewHolder.mDynamic.setText(String.valueOf(mRandom.nextInt(200)) + "条新动态,点这里刷新");
footViewHolder.mRefreshBtn.setOnClickListener(v -> footViewHolder.mRefreshBtn
    .animate()
    .rotation(360)
    .setInterpolator(new LinearInterpolator())
    .setDuration(1000).start());
footViewHolder.mRecommendRefresh.setOnClickListener(v -> footViewHolder.mRecommendRefresh
    .animate()
    .rotation(360)
    .setInterpolator(new LinearInterpolator())

代码示例来源:origin: fython/MaterialStepperView

mDoneIconView.animate().alpha(1f).setDuration(mAnimationDuration).start();
  mPointNumber.animate().alpha(0f).setDuration(mAnimationDuration).start();
} else if (state != STATE_DONE && mState == STATE_DONE) {
  mDoneIconView.animate().alpha(0f).setDuration(mAnimationDuration).start();
  mPointNumber.animate().alpha(1f).setDuration(mAnimationDuration).start();
} else {
    mErrorIconView.setScaleY(0.6F);
    if (mErrorIconAnimator != null) mErrorIconAnimator.cancel();
    mErrorIconAnimator = mErrorIconView.animate().scaleX(1F).scaleY(1F)
        .alpha(1F).setDuration(mAnimationDuration).setInterpolator(new OvershootInterpolator());
    mErrorIconAnimator.start();
    mPointAnimator.start();
    if (mErrorIconAnimator != null) mErrorIconAnimator.cancel();
    mErrorIconAnimator = mErrorIconView.animate().alpha(0F).setDuration(mAnimationDuration);
    mErrorIconAnimator.start();

代码示例来源:origin: frogermcs/InstaMaterial

private void startIntroAnimation() {
  fabCreate.setTranslationY(2 * getResources().getDimensionPixelOffset(R.dimen.btn_fab_size));
  int actionbarSize = Utils.dpToPx(56);
  getToolbar().setTranslationY(-actionbarSize);
  getIvLogo().setTranslationY(-actionbarSize);
  getInboxMenuItem().getActionView().setTranslationY(-actionbarSize);
  getToolbar().animate()
      .translationY(0)
      .setDuration(ANIM_DURATION_TOOLBAR)
      .setStartDelay(300);
  getIvLogo().animate()
      .translationY(0)
      .setDuration(ANIM_DURATION_TOOLBAR)
      .setStartDelay(400);
  getInboxMenuItem().getActionView().animate()
      .translationY(0)
      .setDuration(ANIM_DURATION_TOOLBAR)
      .setStartDelay(500)
      .setListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
          startContentAnimation();
        }
      })
      .start();
}

代码示例来源:origin: fossasia/pslab-android

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.splash_screen);
  ButterKnife.bind(this);
  logo = findViewById(R.id.imageView);
  text = findViewById(R.id.PSLabText);
  logo.animate().alpha(1f).setDuration(2500);
  text.animate().alpha(1f).setDuration(2500);
  PSLabPermission psLabPermission = PSLabPermission.getInstance();
  if (psLabPermission.checkPermissions(SplashActivity.this,
      PSLabPermission.ALL_PERMISSION)) {
    exitSplashScreen();
  }
}

代码示例来源:origin: GeekGhost/Ghost

@Override
public void showContent(List<String> list) {
  if (list != null) {
    int page = StringUtils.getRandomNumber(0, list.size() - 1);
    ImageLoader.load(mContext, list.get(page), ivWelcomeBg);
    ivWelcomeBg.animate().scaleX(1.12f).scaleY(1.12f).setDuration(2000).setStartDelay(100).start();
  }
}

代码示例来源:origin: michael-rapp/ChromeLikeTabSwitcher

@Override
protected final void onPostExecute(@NonNull final ImageView view, @Nullable final Bitmap data,
                  final long duration, @NonNull final TabItem... params) {
  view.setImageBitmap(data);
  if (data != null) {
    boolean useFadeAnimation = duration > model.getTabPreviewFadeThreshold();
    view.setAlpha(useFadeAnimation ? 0f : 1f);
    view.setVisibility(View.VISIBLE);
    if (useFadeAnimation) {
      view.animate().alpha(1f).setDuration(model.getTabPreviewFadeDuration())
          .setInterpolator(new AccelerateDecelerateInterpolator()).start();
    }
  } else {
    view.setVisibility(View.INVISIBLE);
  }
  view.setVisibility(data != null ? View.VISIBLE : View.GONE);
  TabItem tabItem = params[0];
  contentViewRecycler.remove(tabItem.getTab());
}

代码示例来源:origin: armcha/LuseenBottomNavigation

icon.animate()
    .setDuration(150)
    .scaleX((float) 1.1)
  BottomNavigationUtils.changeViewTopPadding(view, viewActivePaddingTop, withText ? viewInactivePaddingTop : viewInactivePaddingTopWithoutText);
icon.animate()
    .setDuration(150)
    .scaleX((float) 0.9)

代码示例来源:origin: iielse/ImageWatcher

imageView.animate().alpha(1).start();

代码示例来源:origin: iielse/ImageWatcher

ViewState.restore(imageView, vsDefault.mTag);
imageView.setAlpha(0f);
imageView.animate().alpha(1).start();

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

Button button = (Button) findViewById(R.id.your_button);
ImageView imageView = (ImageView) findViewById(R.id.imgTest);

button.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View view) {

      imageView.animate().alpha(0.2f).setDuration(1000);

  }
};

代码示例来源:origin: alexjlockwood/adp-activity-transitions

@Override
  public void onTransitionEnd(Transition transition) {
    backgroundImage.animate().setDuration(mBackgroundImageFadeMillis).alpha(1f);
  }
});

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

button.setOnClickListener(new View.OnClickListener() {
  @Override
  public void onClick(View v) {
    ImageView imageView = (ImageView) findViewById(R.id.image);

    float alpha = imageView.getAlpha();

    if (alpha == 0f) {
      imageView.animate().alpha(1f).setDuration(500);
    } else if (alpha == 1f) {
      imageView.animate().alpha(0f).setDuration(500);
    }
  }
});

代码示例来源:origin: vivchar/ViewPagerIndicator

private void setSelectedIndex(final int selectedIndex) {
    if (selectedIndex < 0 || selectedIndex > mPageCount - 1) {
        return;
    }
    final ImageView unselectedView = mIndexImages.get(mSelectedIndex);
    unselectedView.animate().scaleX(NO_SCALE).scaleY(NO_SCALE).setDuration(300).start();
    unselectedView.setColorFilter(mItemColor, android.graphics.PorterDuff.Mode.SRC_IN);
    final ImageView selectedView = mIndexImages.get(selectedIndex);
    selectedView.animate().scaleX(mItemScale).scaleY(mItemScale).setDuration(300).start();
    selectedView.setColorFilter(mItemSelectedColor, android.graphics.PorterDuff.Mode.SRC_IN);
    mSelectedIndex = selectedIndex;
}

代码示例来源:origin: JmStefanAndroid/PVCloudGroupn

@Override
public void onSuccess() {
  holder.imageView.animate()
      .scaleX(1.f).scaleY(1.f)
      .setInterpolator(new OvershootInterpolator())
      .setDuration(400)
      .setStartDelay(200)
      .start();
}

代码示例来源:origin: andforce/iBeebo

private void playImageViewAnimation(final ImageView view, final Bitmap bitmap) {
  view.setImageBitmap(bitmap);
  resetProgressBarStatues();
  view.setAlpha(0f);
  view.animate().alpha(1.0f).setDuration(500).setListener(new LayerEnablingAnimatorListener(view, null));
  view.setTag(getUrl());
}

代码示例来源:origin: woxingxiao/GracefulMovies

private void jumpToMain() {
    mHandler.removeCallbacksAndMessages(null);
    mBinding.splashBgIv.animate().cancel();

    BaseActivity.navigate(SplashActivity.this, MainActivity.class);
    overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
    finish();
  }
}

代码示例来源:origin: yshrsmz/LicenseAdapter

private void updateExpandedStatus(boolean animate) {
  expand.setVisibility(expandableLibrary.getLibrary().hasContent() ? View.VISIBLE : View.GONE);

  float rotation = expandableLibrary.isExpanded() ? 180 : 0;
  if (animate) {
   expand.animate().rotation(rotation).start();
  } else {
   expand.setRotation(rotation);
  }
 }
}

相关文章

ImageView类方法