本文整理汇总了Java中android.widget.ImageView.setRotationY方法的典型用法代码示例。如果您正苦于以下问题:Java ImageView.setRotationY方法的具体用法?Java ImageView.setRotationY怎么用?Java ImageView.setRotationY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.ImageView
的用法示例。
在下文中一共展示了ImageView.setRotationY方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createRotationTransitionAnimation
import android.widget.ImageView; //导入方法依赖的package包/类
/**
* Creates an animation that rotates an {@link ImageView}
* around the Y axis by 180 degrees and changes the image
* resource shown when the view is rotated 90 degrees to the user.
*
* @param imageView the view to rotate.
* @param drawableRes the drawable to set when the view
* is rotated by 90 degrees.
* @return an animation that will change the image shown by the view.
*/
@NonNull
public static Animation createRotationTransitionAnimation(@NonNull final ImageView imageView,
@DrawableRes final int drawableRes) {
Animation animation = new Animation() {
private boolean mSetFinalDrawable;
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
if (interpolatedTime < 0.5f) {
imageView.setRotationY(90 * interpolatedTime * 2f);
} else {
if (!mSetFinalDrawable) {
mSetFinalDrawable = true;
imageView.setImageResource(drawableRes);
}
imageView.setRotationY((-90) + (90 * (interpolatedTime - 0.5f) * 2f));
}
}
};
animation.setDuration(300);
animation.setInterpolator(new AccelerateDecelerateInterpolator());
return animation;
}