use of android.view.animation.RotateAnimation in project KJFrameForAndroid by kymjs.
the class KJAnimations method getRotateAnimation.
/**
* 旋转 Rotate
*/
public static Animation getRotateAnimation(float fromDegrees, float toDegrees, long durationMillis) {
RotateAnimation rotate = new RotateAnimation(fromDegrees, toDegrees, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
rotate.setDuration(durationMillis);
rotate.setFillAfter(true);
return rotate;
}
use of android.view.animation.RotateAnimation in project JustAndroid by chinaltz.
the class AbListViewHeader method initView.
/**
* 初始化View.
*/
private void initView() {
// 顶部刷新栏整体内容
headerView = new LinearLayout(context);
headerView.setOrientation(LinearLayout.HORIZONTAL);
headerView.setGravity(Gravity.CENTER);
AbViewUtil.setPadding(headerView, 0, 10, 0, 10);
// 显示箭头与进度
FrameLayout headImage = new FrameLayout(context);
arrowImageView = new ImageView(context);
// 箭头图片
arrowImageView.setImageResource(R.drawable.arrow);
// style="?android:attr/progressBarStyleSmall" 默认的样式
headerProgressBar = new ProgressBar(context, null, android.R.attr.progressBarStyle);
headerProgressBar.setVisibility(View.GONE);
LayoutParams layoutParamsWW = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
layoutParamsWW.gravity = Gravity.CENTER;
layoutParamsWW.width = AbViewUtil.scaleValue(context, 50);
layoutParamsWW.height = AbViewUtil.scaleValue(context, 50);
headImage.addView(arrowImageView, layoutParamsWW);
headImage.addView(headerProgressBar, layoutParamsWW);
// 顶部刷新栏文本内容
LinearLayout headTextLayout = new LinearLayout(context);
tipsTextview = new TextView(context);
headerTimeView = new TextView(context);
headTextLayout.setOrientation(LinearLayout.VERTICAL);
headTextLayout.setGravity(Gravity.CENTER_VERTICAL);
AbViewUtil.setPadding(headTextLayout, 0, 0, 0, 0);
LayoutParams layoutParamsWW2 = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
headTextLayout.addView(tipsTextview, layoutParamsWW2);
headTextLayout.addView(headerTimeView, layoutParamsWW2);
tipsTextview.setTextColor(Color.rgb(107, 107, 107));
headerTimeView.setTextColor(Color.rgb(107, 107, 107));
AbViewUtil.setTextSize(tipsTextview, 30);
AbViewUtil.setTextSize(headerTimeView, 27);
LayoutParams layoutParamsWW3 = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
layoutParamsWW3.gravity = Gravity.CENTER;
layoutParamsWW3.rightMargin = AbViewUtil.scaleValue(context, 10);
LinearLayout headerLayout = new LinearLayout(context);
headerLayout.setOrientation(LinearLayout.HORIZONTAL);
headerLayout.setGravity(Gravity.CENTER);
headerLayout.addView(headImage, layoutParamsWW3);
headerLayout.addView(headTextLayout, layoutParamsWW3);
LayoutParams lp = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
lp.gravity = Gravity.BOTTOM;
// 添加大布局
headerView.addView(headerLayout, lp);
this.addView(headerView, lp);
// 获取View的高度
AbViewUtil.measureView(this);
headerHeight = this.getMeasuredHeight();
mRotateUpAnim = new RotateAnimation(0.0f, -180.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
mRotateUpAnim.setDuration(ROTATE_ANIM_DURATION);
mRotateUpAnim.setFillAfter(true);
mRotateDownAnim = new RotateAnimation(-180.0f, 0.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
mRotateDownAnim.setDuration(ROTATE_ANIM_DURATION);
mRotateDownAnim.setFillAfter(true);
setState(STATE_NORMAL);
}
use of android.view.animation.RotateAnimation in project AndroidSDK-RecipeBook by gabu.
the class Recipe050 method startMix.
public void startMix(View view) {
AnimationSet animation = new AnimationSet(true);
// 透明になりながら
animation.addAnimation(new AlphaAnimation(1.0F, 0.0F));
// 回転しながら
animation.addAnimation(new RotateAnimation(0, 360));
// 拡大しながら
animation.addAnimation(new ScaleAnimation(1, 2, 1, 2));
// 移動しながら
animation.addAnimation(new TranslateAnimation(0, 300, 0, 300));
// 3秒で
animation.setDuration(3000);
mImageView.startAnimation(animation);
}
use of android.view.animation.RotateAnimation in project AndroidSDK-RecipeBook by gabu.
the class Recipe050 method startRotate.
public void startRotate(View view) {
RotateAnimation animation;
animation = new RotateAnimation(0, 360, mImageView.getWidth() / 2.0F, mImageView.getHeight() / 2.0F);
// 3秒で
animation.setDuration(3000);
mImageView.startAnimation(animation);
}
use of android.view.animation.RotateAnimation in project curb by irijwj.
the class AutoFitAdapter method animClose.
private void animClose(final View view, final ImageView rotateView) {
int origHeight = view.getHeight();
view.setAlpha(1);
float from = 0.0f;
float to = 180.0f;
RotateAnimation lc_rotateAnimation = new RotateAnimation(to, from, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
lc_rotateAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
lc_rotateAnimation.setDuration(300);
lc_rotateAnimation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
rotateView.setImageResource(R.drawable.ic_info_item_more);
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
Animator mCloseValueAnimator = createDropAnim(view, origHeight, 0);
mCloseValueAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
view.setVisibility(View.GONE);
}
});
mCloseValueAnimator.start();
rotateView.startAnimation(lc_rotateAnimation);
}
Aggregations