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

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

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

ImageView.getRotation介绍

暂无

代码示例

代码示例来源:origin: AndroidKun/PullToRefreshRecyclerView

private void rotationAnimator(float rotation) {
  ValueAnimator animator = ValueAnimator.ofFloat(imageArrow.getRotation(), rotation);
  animator.setDuration(200).start();
  animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
    @Override
    public void onAnimationUpdate(ValueAnimator animation) {
      imageArrow.setRotation((Float) animation.getAnimatedValue());
    }
  });
  animator.start();
}

代码示例来源:origin: AndroidKun/PullToRefreshRecyclerView

public void startRefreshingAnimation() {
    animator = ValueAnimator.ofFloat(imageRefreshing.getRotation(), imageRefreshing.getRotation()+359);
    animator.setDuration(1000).start();
    animator.setInterpolator(new LinearInterpolator());
    animator.setRepeatCount(ValueAnimator.INFINITE);
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
      @Override
      public void onAnimationUpdate(ValueAnimator animation) {
        imageRefreshing.setRotation((Float) animation.getAnimatedValue());
      }
    });
    animator.start();
/*
    RotateAnimation animation = new RotateAnimation(0f, 359f, Animation.RELATIVE_TO_SELF,
        0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    animation.setInterpolator(new LinearInterpolator());
    animation.setDuration(1000);
    animation.setRepeatCount(Animation.INFINITE);
    imageRefreshing.startAnimation(animation);*/
  }

代码示例来源:origin: AndroidKun/PullToRefreshRecyclerView

public void startAnimation() {
  if(animator!=null && animator.isStarted()){
    return;
  }
  animator = ValueAnimator.ofFloat(imageLoadMore.getRotation()
      ,imageLoadMore.getRotation()+359);
  animator.setInterpolator(new LinearInterpolator());
  animator.setRepeatCount(ValueAnimator.INFINITE);
  animator.setDuration(1000);
  animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
    @Override
    public void onAnimationUpdate(ValueAnimator animation) {
      imageLoadMore.setRotation((Float) animation.getAnimatedValue());
    }
  });
  animator.start();
 /* RotateAnimation animation = new RotateAnimation(0f, 359f, Animation.RELATIVE_TO_SELF,
      0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
  animation.setInterpolator(new LinearInterpolator());
  animation.setDuration(1000);
  animation.setRepeatCount(Animation.INFINITE);
  imageLoadMore.startAnimation(animation);*/
}
public void stopAnimation() {

代码示例来源:origin: jjhesk/KickAssSlidingMenu

private void animateIndicator(final boolean open) {
  if (animate_indicator) {
    //indicator.clearAnimation();
    final Animation r = new RotateAnimation(indicator.getRotation(),
        !open ? 0 : 90f, open ? Animation.RELATIVE_TO_SELF : Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    r.setAnimationListener(new Animation.AnimationListener() {
      @Override
      public void onAnimationStart(Animation animation) {
      }
      @Override
      public void onAnimationEnd(Animation animation) {
        ViewCompat.setRotation(indicator, !open ? 0f : 90f);
      }
      @Override
      public void onAnimationRepeat(Animation animation) {
      }
    });
    r.setDuration(500);
    indicator.startAnimation(r);
  }
}

代码示例来源:origin: vogellacompany/codeexamples-android

@Override
  public void run() {
    //
    aniView.animate()
        .rotationXBy(100)
        .rotation(
            Math.abs(360 - aniView
                .getRotation()))
        .scaleX(0.4F).scaleY(0.4F)
        .setDuration(1000);
  }
});

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

public Bitmap mergeBitmaps() {
  Bitmap baseBitmap = ((BitmapDrawable) image.getDrawable()).getBitmap();

  Bitmap mergedBitmap = Bitmap.createBitmap(baseBitmap.getWidth(), baseBitmap.getHeight(), baseBitmap.getConfig());
  Canvas canvas = new Canvas(mergedBitmap);
  canvas.drawBitmap(baseBitmap, new Matrix(), null);

  for (ImageView sticker: stickers) {
    float viewSizeRatio = (float) sticker.getWidth() / image.getWidth();
    float bitmapSizeRatio = (float) sticker.getDrawable().getBounds().width() / image.getDrawable().getBounds().width();
    float ratioFactor = viewSizeRatio / bitmapSizeRatio;

    float deltaX = sticker.getTranslationX()* ratioFactor;
    float deltaY = sticker.getTranslationY()* ratioFactor;
    float scaleX = sticker.getScaleX()* ratioFactor;
    float scaleY = sticker.getScaleY()* ratioFactor;
    float rotation = sticker.getRotation();

    Matrix matrix = new Matrix();
    matrix.postScale(scaleX, scaleY);
    matrix.postRotate(rotation);
    matrix.postTranslate(deltaX, deltaY);

    Bitmap stickerBitmap = ((BitmapDrawable) sticker.getDrawable()).getBitmap();
    canvas.drawBitmap(stickerBitmap, matrix, null);
  }

  return mergedBitmap;
}

代码示例来源:origin: vogellacompany/codeexamples-android

if (aniView.getRotation() == 360) {
  dest = 0;

代码示例来源:origin: P3tr0viCh/ExpansionPanel

final float stateIconRotation = mStateIcon.getRotation();

代码示例来源:origin: madreain/AndroidDream

@Override
  public void onClick(View v) {
    if ((mTextureView.getRotation() - mRotate) == 270) {
      mTextureView.setRotation(mRotate);
      mTextureView.requestLayout();
      mCoverImageView.setRotation(mRotate);
      mCoverImageView.requestLayout();
    } else {
      mTextureView.setRotation(mTextureView.getRotation() + 90);
      mTextureView.requestLayout();
      mCoverImageView.setRotation(mCoverImageView.getRotation() + 90);
      mCoverImageView.requestLayout();
    }
  }
});

相关文章

ImageView类方法