本文整理匯總了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;
}