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

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

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

ImageView.setTranslationY介绍

暂无

代码示例

代码示例来源:origin: tyzlmjj/PagerBottomTabStrip

@Override
  public void onAnimationUpdate(ValueAnimator animation) {
    mAnimatorValue = (float) animation.getAnimatedValue();
    if (mHideTitle) {
      mIcon.setTranslationY(-mTranslationHideTitle * mAnimatorValue);
    } else {
      mIcon.setTranslationY(-mTranslation * mAnimatorValue);
    }
    mLabel.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12f + mAnimatorValue * 2f);
  }
});

代码示例来源:origin: jdsjlzx/LRecyclerView

@Override public void onAnimationUpdate(ValueAnimator animation) {
  if (mRefreshView.getTranslationY() == mRefreshHideTranslationY) {
   animation.cancel();
  } else {
   mRefreshView.setTranslationY((Float) animation.getAnimatedValue());
  }
 }
});

代码示例来源:origin: jdsjlzx/LRecyclerView

@Override public void onAnimationUpdate(ValueAnimator animation) {
  if (mRefreshView.getTranslationY() == mRefreshHideTranslationY) {
   animation.cancel();
  } else {
   mRefreshView.setTranslationY((Float) animation.getAnimatedValue());
  }
 }
});

代码示例来源: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: tyzlmjj/PagerBottomTabStrip

mIcon.setTranslationY(-mTranslationHideTitle);
} else {
  mIcon.setTranslationY(-mTranslation);
mIcon.setTranslationY(0);
mLabel.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12f);

代码示例来源:origin: ZieIony/Carbon

@Override
public void setTranslationY(float translationY) {
  super.setTranslationY(translationY);
  invalidateParentIfNeeded();
  fireOnTransformationChangedListener();
}

代码示例来源:origin: jdsjlzx/LRecyclerView

public void setState(int state) {
 if (state == mState) return;
 if (state == STATE_REFRESHING) {  // 显示进度
  mRefreshView.setTranslationY(mRefreshShowTranslationY);
  refreshing();
 } else if (state == STATE_DONE) {
  reset();
 }
 mState = state;
}

代码示例来源:origin: jdsjlzx/LRecyclerView

public void setState(int state) {
 if (state == mState) return;
 if (state == STATE_REFRESHING) {  // 显示进度
  mRefreshView.setTranslationY(mRefreshShowTranslationY);
  refreshing();
 } else if (state == STATE_DONE) {
  reset();
 }
 mState = state;
}

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

mImageView.setTranslationY(-final_loc * 0.4f * density);

代码示例来源:origin: jdsjlzx/LRecyclerView

/**
 * refreshView在刷新区间内相对位移并跟随位移速度旋转
 */
private void refreshTranslation(int currentHeight, float offSet) {
 if ((currentHeight - mHeaderViewHeight) / 2 < mRefreshShowTranslationY - mRefreshHideTranslationY) { // 判断是否在非刷新区间
  float translationY = mRefreshView.getTranslationY() - offSet / 2; // 布局高度增加offset 相当于距离上边距offSet / 2
  if (translationY > mRefreshShowTranslationY) {
   translationY = mRefreshShowTranslationY;
  } else if (translationY < mRefreshHideTranslationY) {
   translationY = mRefreshHideTranslationY;
  }
  if (Math.abs(translationY) != mRefreshView.getTranslationY()) {
   mRefreshView.setTranslationY(translationY);
  }
 }
 mRefreshView.setRotation(mRotateAngle -= offSet);//旋转,角度大小跟随偏移量
}

代码示例来源:origin: jdsjlzx/LRecyclerView

/**
 * refreshView在刷新区间内相对位移并跟随位移速度旋转
 */
private void refreshTranslation(int currentHeight, float offSet) {
 if ((currentHeight - mHeaderViewHeight) / 2 < mRefreshShowTranslationY - mRefreshHideTranslationY) { // 判断是否在非刷新区间
  float translationY = mRefreshView.getTranslationY() - offSet / 2; // 布局高度增加offset 相当于距离上边距offSet / 2
  if (translationY > mRefreshShowTranslationY) {
   translationY = mRefreshShowTranslationY;
  } else if (translationY < mRefreshHideTranslationY) {
   translationY = mRefreshHideTranslationY;
  }
  if (Math.abs(translationY) != mRefreshView.getTranslationY()) {
   mRefreshView.setTranslationY(translationY);
  }
 }
 mRefreshView.setRotation(mRotateAngle -= offSet);//旋转,角度大小跟随偏移量
}

代码示例来源: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: iielse/ImageWatcher

float changedCenterY = mFingersCenterY - centerY;
float changedCenterYValue = vsTouchScale.translationY - changedCenterY;
iSource.setTranslationY(changedCenterYValue);

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

Glide.with(getContext()).load(thumbList.get(i)).into(iPicture);
  iPicture.setTranslationX((i % column) * (imageSize + mSpace));
  iPicture.setTranslationY((i / column) * (imageSize + mSpace));
} else {
  iPicture.setVisibility(View.GONE);

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

translateYValue = translateYBottomEdge + (translateYValue - translateYBottomEdge) * edgeResilience;
iSource.setTranslationY(translateYValue);

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

/**
 * 处理响应退出图片查看
 */
private void handleExitGesture(MotionEvent e2, MotionEvent e1) {
  if (iSource == null) return;
  ViewState vsExit = ViewState.read(iSource, ViewState.STATE_EXIT);
  ViewState vsDefault = ViewState.read(iSource, ViewState.STATE_DEFAULT);
  if (vsExit == null || vsDefault == null) return;
  mExitRef = 1;
  final float moveY = e2.getY() - e1.getY();
  final float moveX = e2.getX() - e1.getX();
  if (moveY > 0) mExitRef -= moveY / (mHeight / 2);
  if (mExitRef < 0) mExitRef = 0;
  setBackgroundColor(mColorEvaluator.evaluate(mExitRef, 0x00000000, 0xFF000000));
  final float exitScale = MIN_SCALE + (vsExit.scaleX - MIN_SCALE) * mExitRef;
  iSource.setScaleX(exitScale);
  iSource.setScaleY(exitScale);
  final float exitTrans = vsDefault.translationX + (vsExit.translationX - vsDefault.translationX) * mExitRef;
  iSource.setTranslationX(exitTrans + moveX);
  iSource.setTranslationY(vsExit.translationY + moveY);
}

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

int locationYOfFullScreen = location[1];
locationYOfFullScreen -= mStatusBarHeight;
imageView.setTranslationY(locationYOfFullScreen);
imageView.getLayoutParams().width = originRef.getWidth();
imageView.getLayoutParams().height = originRef.getHeight();

代码示例来源:origin: Cutta/ContinuousScrollableImageView

@Override
  public void onAnimationUpdate(ValueAnimator animation) {
    {
      float progress = DIRECTION_MULTIPLIER * (-(float) animation.getAnimatedValue());
      float height = DIRECTION_MULTIPLIER * (-firstImage.getHeight());
      float translationY = height * progress;
      firstImage.setTranslationY(translationY);
      secondImage.setTranslationY(translationY - height);
    }
  }
});

代码示例来源:origin: kot32go/KSimpleLibrary

@Override
public void loadTips(View headerView, int progress) {
  float scaleRatio = ((float) progress) / 100;
  people.setScaleX(scaleRatio);
  people.setScaleY(scaleRatio);
  box.setScaleX(scaleRatio);
  box.setScaleY(scaleRatio);
  people.setTranslationX(tx * scaleRatio);
  box.setTranslationY(ty * scaleRatio);
  tips.setText("上拉加载...");
  frameAnimation.stop();
}

代码示例来源:origin: kot32go/KSimpleLibrary

@Override
public void pullingTips(View headerView, int progress) {
  float scaleRatio = ((float) progress) / 100;
  people.setScaleX(scaleRatio);
  people.setScaleY(scaleRatio);
  box.setScaleX(scaleRatio);
  box.setScaleY(scaleRatio);
  people.setTranslationX(tx * scaleRatio);
  box.setTranslationY(ty * scaleRatio);
  tips.setText("下拉更新...");
  frameAnimation.stop();
}

相关文章

ImageView类方法