當前位置: 首頁>>代碼示例>>Java>>正文


Java RotateAnimation類代碼示例

本文整理匯總了Java中android.view.animation.RotateAnimation的典型用法代碼示例。如果您正苦於以下問題:Java RotateAnimation類的具體用法?Java RotateAnimation怎麽用?Java RotateAnimation使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


RotateAnimation類屬於android.view.animation包,在下文中一共展示了RotateAnimation類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: open

import android.view.animation.RotateAnimation; //導入依賴的package包/類
public void open() {

        AnimationSet animationSet = new AnimationSet(true);
        animationSet.setDuration(duration);
        animationSet.setAnimationListener(this);
        animationSet.setFillAfter(true);

        RotateAnimation rotateAnimation = new RotateAnimation(270, 360,
                Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
        animationSet.addAnimation(rotateAnimation);
        Animation scaleAnimation = new ScaleAnimation(1.25f, 1f, 1.25f, 1f,
                ScaleAnimation.RELATIVE_TO_SELF, 0.5f, ScaleAnimation.RELATIVE_TO_SELF, 0.5f);
        animationSet.addAnimation(scaleAnimation);
        imageView.startAnimation(animationSet);


        AnimatorSet animatorSet = new AnimatorSet();
        ObjectAnimator animator1 = ObjectAnimator.ofInt(mLinearLayout, "width", 0, mLinearLayoutWidth);
        ObjectAnimator animator2 = ObjectAnimator.ofInt(mLinearLayout, "paddingLeft", 0, savePaddingLeft);
        ObjectAnimator animator3 = ObjectAnimator.ofInt(mLinearLayout, "paddingRight", 0, savePaddingRight);
        ObjectAnimator animator4 = ObjectAnimator.ofInt(mLinearLayout, "marginLeft", 0, saveMarginLeft);
        ObjectAnimator animator5 = ObjectAnimator.ofInt(mLinearLayout, "marginRight", 0, saveMarginRight);
        animatorSet.playTogether(animator1, animator2, animator3, animator4, animator5);
        animatorSet.setDuration(duration).start();

    }
 
開發者ID:ViewStub,項目名稱:ExpandButton,代碼行數:27,代碼來源:ExpandButtonLayout.java

示例2: startShowContinueIconAnimations

import android.view.animation.RotateAnimation; //導入依賴的package包/類
private AnimationSet startShowContinueIconAnimations() {
	Animation mScaleAnimation = new ScaleAnimation(0, 1, 0, 1, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
	Animation mRotateAnimation = new RotateAnimation(
				0, 360,
				Animation.RELATIVE_TO_SELF, 0.5f,
				Animation.RELATIVE_TO_SELF, 0.5f
	);
	mRotateAnimation.setRepeatCount(0);

	AnimationSet mAnimations = new AnimationSet(true);
	mAnimations.setDuration(REVEAL_ANIMATION_DURATION);
	mAnimations.setFillAfter(true);
	mAnimations.setInterpolator(new OvershootInterpolator(1.5f));
	mAnimations.addAnimation(mScaleAnimation);
	mAnimations.addAnimation(mRotateAnimation);

	mContinueIcon.startAnimation(mAnimations);
	return mAnimations;
}
 
開發者ID:SebastianRask,項目名稱:Pocket-Plays-for-Twitch,代碼行數:20,代碼來源:WelcomeActivity.java

示例3: init

import android.view.animation.RotateAnimation; //導入依賴的package包/類
private void init(Context context) {
	mFlipAnimation = new RotateAnimation(0, -180,
			RotateAnimation.RELATIVE_TO_SELF, 0.5f,
			RotateAnimation.RELATIVE_TO_SELF, 0.5f);
	mFlipAnimation.setInterpolator(new LinearInterpolator());
	mFlipAnimation.setDuration(250);
	mFlipAnimation.setFillAfter(true);
	mReverseFlipAnimation = new RotateAnimation(-180, 0,
			RotateAnimation.RELATIVE_TO_SELF, 0.5f,
			RotateAnimation.RELATIVE_TO_SELF, 0.5f);
	mReverseFlipAnimation.setInterpolator(new LinearInterpolator());
	mReverseFlipAnimation.setDuration(250);
	mReverseFlipAnimation.setFillAfter(true);

	mRefreshView = (LinearLayout) View.inflate(context, R.layout.pull_to_refresh_header, null);
	mRefreshViewText = (TextView) mRefreshView.findViewById(R.id.pull_to_refresh_text);
	mRefreshViewImage = (ImageView) mRefreshView.findViewById(R.id.pull_to_refresh_image);
	mRefreshViewProgress = (ProgressBar) mRefreshView.findViewById(R.id.pull_to_refresh_progress);
	mRefreshViewLastUpdated = (TextView) mRefreshView.findViewById(R.id.pull_to_refresh_updated_at);

	mRefreshState = PULL_TO_REFRESH;
	mRefreshViewImage.setMinimumHeight(50); //設置下拉最小的高度為50
	
	setFadingEdgeLength(0);
	setHeaderDividersEnabled(false);

	//把refreshview加入到listview的頭部
	addHeaderView(mRefreshView);
	super.setOnScrollListener(this);
	mRefreshView.setOnClickListener(this);

	mRefreshView.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
	mRefreshViewHeight = mRefreshView.getMeasuredHeight();
	mRefreshOriginalTopPadding = -mRefreshViewHeight;
	
	resetHeaderPadding();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:38,代碼來源:PullToRefreshListView.java

示例4: initView

import android.view.animation.RotateAnimation; //導入依賴的package包/類
private void initView(Context context) {
	// 初始情況,設置下拉刷新view高度為0
	LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
			LayoutParams.MATCH_PARENT, 0);
	mContainer = (LinearLayout) LayoutInflater.from(context).inflate(
			R.layout.xlistview_header, null);
	addView(mContainer, lp);
	setGravity(Gravity.BOTTOM);

	mArrowImageView = findViewById(R.id.xlistview_header_arrow);
	mHintTextView = (TextView)findViewById(R.id.xlistview_header_hint_textview);
	mProgressBar = findViewById(R.id.xlistview_header_progressbar);
	
	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);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:25,代碼來源:XListViewHeader.java

示例5: initView

import android.view.animation.RotateAnimation; //導入依賴的package包/類
private void initView(Context context) {
        mLayout = LayoutInflater.from(context).inflate(R.layout.vw_footer, null);
        mLayout.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT,
                LayoutParams.WRAP_CONTENT));
        addView(mLayout);

        mProgressBar = mLayout.findViewById(R.id.footer_progressbar);
        mHintView = (TextView) mLayout.findViewById(R.id.footer_hint_text);
//        mHintImage = (ImageView) mLayout.findViewById(R.id.footer_arrow);

        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);
    }
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:21,代碼來源:XFooterView.java

示例6: createShrinkAnimation

import android.view.animation.RotateAnimation; //導入依賴的package包/類
private static Animation createShrinkAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta,
		long startOffset, long duration, Interpolator interpolator) {
	AnimationSet animationSet = new AnimationSet(false);
	animationSet.setFillAfter(true);

	final long preDuration = duration / 2;
	Animation rotateAnimation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f,
			Animation.RELATIVE_TO_SELF, 0.5f);
	rotateAnimation.setStartOffset(startOffset);
	rotateAnimation.setDuration(preDuration);
	rotateAnimation.setInterpolator(new LinearInterpolator());
	rotateAnimation.setFillAfter(true);

	animationSet.addAnimation(rotateAnimation);

	Animation translateAnimation = new RotateAndTranslateAnimation(0, toXDelta, 0, toYDelta, 360, 720);
	translateAnimation.setStartOffset(startOffset + preDuration);
	translateAnimation.setDuration(duration - preDuration);
	translateAnimation.setInterpolator(interpolator);
	translateAnimation.setFillAfter(true);

	animationSet.addAnimation(translateAnimation);

	return animationSet;
}
 
開發者ID:cheenid,項目名稱:FLFloatingButton,代碼行數:26,代碼來源:RayLayout.java

示例7: onViewCreated

import android.view.animation.RotateAnimation; //導入依賴的package包/類
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
  final SimpleDraweeView draweeView = (SimpleDraweeView) view.findViewById(R.id.drawee_view);
  draweeView.setActualImageResource(R.drawable.logo);
  draweeView.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
      final RotateAnimation rotateAnimation = new RotateAnimation(
          0,
          360,
          Animation.RELATIVE_TO_SELF,
          0.5f,
          Animation.RELATIVE_TO_SELF,
          0.5f);
      rotateAnimation.setDuration(1000);
      rotateAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
      draweeView.startAnimation(rotateAnimation);
    }
  });

  final Button buttonGitHub = (Button) view.findViewById(R.id.button_github);
  setUriIntent(buttonGitHub, URL_GITHUB);

  final Button buttonDocumentation = (Button) view.findViewById(R.id.button_documentation);
  setUriIntent(buttonDocumentation, URL_DOCUMENTATION);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:27,代碼來源:WelcomeFragment.java

示例8: RotateLoadingLayout

import android.view.animation.RotateAnimation; //導入依賴的package包/類
public RotateLoadingLayout(Context context, Mode mode, Orientation scrollDirection, TypedArray attrs) {
	super(context, mode, scrollDirection, attrs);

	mRotateDrawableWhilePulling = attrs.getBoolean(R.styleable.PullToRefresh_ptrRotateDrawableWhilePulling, true);

	mHeaderImage.setScaleType(ScaleType.MATRIX);
	mHeaderImageMatrix = new Matrix();
	mHeaderImage.setImageMatrix(mHeaderImageMatrix);

	mRotateAnimation = new RotateAnimation(0, 720, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
			0.5f);
	mRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR);
	mRotateAnimation.setDuration(ROTATION_ANIMATION_DURATION);
	mRotateAnimation.setRepeatCount(Animation.INFINITE);
	mRotateAnimation.setRepeatMode(Animation.RESTART);
}
 
開發者ID:ultrasonic,項目名稱:ultrasonic,代碼行數:17,代碼來源:RotateLoadingLayout.java

示例9: FlipLoadingLayout

import android.view.animation.RotateAnimation; //導入依賴的package包/類
public FlipLoadingLayout(Context context, final Mode mode, final Orientation scrollDirection, TypedArray attrs) {
	super(context, mode, scrollDirection, attrs);

	final int rotateAngle = mode == Mode.PULL_FROM_START ? -180 : 180;

	mRotateAnimation = new RotateAnimation(0, rotateAngle, Animation.RELATIVE_TO_SELF, 0.5f,
			Animation.RELATIVE_TO_SELF, 0.5f);
	mRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR);
	mRotateAnimation.setDuration(FLIP_ANIMATION_DURATION);
	mRotateAnimation.setFillAfter(true);

	mResetRotateAnimation = new RotateAnimation(rotateAngle, 0, Animation.RELATIVE_TO_SELF, 0.5f,
			Animation.RELATIVE_TO_SELF, 0.5f);
	mResetRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR);
	mResetRotateAnimation.setDuration(FLIP_ANIMATION_DURATION);
	mResetRotateAnimation.setFillAfter(true);
}
 
開發者ID:ultrasonic,項目名稱:ultrasonic,代碼行數:18,代碼來源:FlipLoadingLayout.java

示例10: RotateLoadingLayout

import android.view.animation.RotateAnimation; //導入依賴的package包/類
public RotateLoadingLayout(Context context, PullToRefreshBase.Mode mode, PullToRefreshBase.Orientation scrollDirection, TypedArray attrs) {
	super(context, mode, scrollDirection, attrs);

	mRotateDrawableWhilePulling = attrs.getBoolean(R.styleable.PullToRefresh_ptrRotateDrawableWhilePulling, true);

	mHeaderImage.setScaleType(ScaleType.MATRIX);
	mHeaderImageMatrix = new Matrix();
	mHeaderImage.setImageMatrix(mHeaderImageMatrix);

	mRotateAnimation = new RotateAnimation(0, 720, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
			0.5f);
	mRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR);
	mRotateAnimation.setDuration(ROTATION_ANIMATION_DURATION);
	mRotateAnimation.setRepeatCount(Animation.INFINITE);
	mRotateAnimation.setRepeatMode(Animation.RESTART);
}
 
開發者ID:BaoBaoJianqiang,項目名稱:CustomListView,代碼行數:17,代碼來源:RotateLoadingLayout.java

示例11: FlipLoadingLayout

import android.view.animation.RotateAnimation; //導入依賴的package包/類
public FlipLoadingLayout(Context context, final PullToRefreshBase.Mode mode, final PullToRefreshBase.Orientation scrollDirection, TypedArray attrs) {
	super(context, mode, scrollDirection, attrs);

	final int rotateAngle = mode == PULL_FROM_START ? -180 : 180;

	mRotateAnimation = new RotateAnimation(0, rotateAngle, Animation.RELATIVE_TO_SELF, 0.5f,
			Animation.RELATIVE_TO_SELF, 0.5f);
	mRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR);
	mRotateAnimation.setDuration(FLIP_ANIMATION_DURATION);
	mRotateAnimation.setFillAfter(true);

	mResetRotateAnimation = new RotateAnimation(rotateAngle, 0, Animation.RELATIVE_TO_SELF, 0.5f,
			Animation.RELATIVE_TO_SELF, 0.5f);
	mResetRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR);
	mResetRotateAnimation.setDuration(FLIP_ANIMATION_DURATION);
	mResetRotateAnimation.setFillAfter(true);
}
 
開發者ID:BaoBaoJianqiang,項目名稱:CustomListView,代碼行數:18,代碼來源:FlipLoadingLayout.java

示例12: init

import android.view.animation.RotateAnimation; //導入依賴的package包/類
private void init(Context context) {
    inflater = LayoutInflater.from(context);
    headView = (LinearLayout) inflater.inflate(R.layout.kf5_list_head, null);
    arrowImageView = (ImageView) headView.findViewById(R.id.kf5_head_arrowImageView);
    arrowImageView.setMinimumWidth(70);
    arrowImageView.setMinimumHeight(50);
    progressBar = (ProgressBar) headView.findViewById(R.id.kf5_head_progressBar);
    tipsTextview = (TextView) headView.findViewById(R.id.kf5_head_tipsTextView);
    lastUpdatedTextView = (TextView) headView.findViewById(R.id.kf5_head_lastUpdatedTextView);
    measureView(headView);
    headContentHeight = headView.getMeasuredHeight();
    headContentWidth = headView.getMeasuredWidth();
    headView.setPadding(0, -1 * headContentHeight, 0, 0);
    headView.invalidate();
    addHeaderView(headView);
    setOnScrollListener(this);
    animation = new RotateAnimation(0, -180,
            RotateAnimation.RELATIVE_TO_SELF, 0.5f,
            RotateAnimation.RELATIVE_TO_SELF, 0.5f);
    animation.setInterpolator(new LinearInterpolator());
    animation.setDuration(250);
    animation.setFillAfter(true);
    reverseAnimation = new RotateAnimation(-180, 0,
            RotateAnimation.RELATIVE_TO_SELF, 0.5f,
            RotateAnimation.RELATIVE_TO_SELF, 0.5f);
    reverseAnimation.setInterpolator(new LinearInterpolator());
    reverseAnimation.setDuration(200);
    reverseAnimation.setFillAfter(true);

    state = DONE;
    isRefreshable = false;
}
 
開發者ID:Zyj163,項目名稱:yyox,代碼行數:33,代碼來源:RefreshListView.java

示例13: rotate

import android.view.animation.RotateAnimation; //導入依賴的package包/類
public static void rotate(View v){
    //創建旋轉動畫 對象   fromDegrees:旋轉開始的角度  toDegrees:結束的角度
    RotateAnimation rotateAnimation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    //設置動畫的顯示時間
    rotateAnimation.setDuration(1000);
    //設置動畫重複播放幾次
    rotateAnimation.setRepeatCount(RotateAnimation.INFINITE);
    //設置動畫插值器
    rotateAnimation.setInterpolator(new LinearInterpolator());
    //設置動畫重複播放的方式,翻轉播放
    rotateAnimation.setRepeatMode(Animation.RESTART);
    //拿著imageview對象來運行動畫效果
    v.setAnimation(rotateAnimation);
}
 
開發者ID:fengdongfei,項目名稱:CXJPadProject,代碼行數:15,代碼來源:AnimationUtil.java

示例14: startLoadingAnimation

import android.view.animation.RotateAnimation; //導入依賴的package包/類
private void startLoadingAnimation(ImageView imageView) {
  RotateAnimation loadingAnimation =
      new RotateAnimation(0f, 360f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
          0.5f);
  loadingAnimation.setDuration(1000);
  loadingAnimation.setRepeatCount(-1);
  loadingAnimation.setInterpolator(new LinearInterpolator());
  loadingAnimation.setFillAfter(false);
  imageView.setAnimation(loadingAnimation);
  loadingAnimation.start();
}
 
開發者ID:Lingzh0ng,項目名稱:BrotherWeather,代碼行數:12,代碼來源:CustomRefreshLayout.java

示例15: startLoadingAnimation

import android.view.animation.RotateAnimation; //導入依賴的package包/類
private void startLoadingAnimation(ImageView imageView) {
  RotateAnimation loadingAnimation =
      new RotateAnimation(0f, 360f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
          0.5f);
  loadingAnimation.setDuration(1000);
  loadingAnimation.setRepeatCount(-1);
  loadingAnimation.setInterpolator(new LinearInterpolator());
  imageView.setAnimation(loadingAnimation);
  loadingAnimation.start();
}
 
開發者ID:Lingzh0ng,項目名稱:BrotherWeather,代碼行數:11,代碼來源:CustomRefreshLayout2.java


注:本文中的android.view.animation.RotateAnimation類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。