android.view.animation.Animation#RELATIVE_TO_SELF源码实例Demo

下面列出了android.view.animation.Animation#RELATIVE_TO_SELF 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: UltimateAndroid   文件: RayLayout.java
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;
}
 
源代码2 项目: VistArrow   文件: Compass.java
private void adjustArrow() {
	if (arrowView == null) {
		Log.i(TAG, "arrow view is not set");
		return;
	}

	Log.i(TAG, "will set rotation from " + currectAzimuth + " to "
			+ azimuth);

	Animation an = new RotateAnimation(-currectAzimuth, -azimuth,
			Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
			0.5f);
	currectAzimuth = azimuth;

	an.setDuration(500);
	an.setRepeatCount(0);
	an.setFillAfter(true);

	arrowView.startAnimation(an);
}
 
源代码3 项目: myapplication   文件: XListViewHeader.java
private void initView(Context context) {
    // 初始情况,设置下拉刷新view高度为0
    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
            LayoutParams.FILL_PARENT, 0);
    mContainer = (LinearLayout) LayoutInflater.from(context).inflate(
            R.layout.xlistview_header, null);
    addView(mContainer, lp);
    setGravity(Gravity.BOTTOM);

    mArrowImageView = (ImageView) findViewById(R.id.xlistview_header_arrow);
    mHintTextView = (TextView) findViewById(R.id.xlistview_header_hint_textview);
    mProgressBar = (ProgressBar) 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);
}
 
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);
}
 
源代码5 项目: UCDMediaPlayer_Android   文件: UVideoMainView.java
private void doHideSettingMenuView() {
    if (settingMenuView != null && isSuccess) {
        settingMenuView.setVisibility(View.GONE);
        TranslateAnimation ta = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 1f, Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0f);
        ta.setDuration(MENU_VIEW_ANIMATION_DURATION);
        settingMenuView.startAnimation(ta);
    }
}
 
源代码6 项目: fangzhuishushenqi   文件: EasyRecyclerView.java
public void showTipView(String tip) {
    tipView.setText(tip);
    Animation mShowAction = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f,
            Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF,
            -1.0f, Animation.RELATIVE_TO_SELF, 0.0f);
    mShowAction.setDuration(500);
    tipView.startAnimation(mShowAction);
    tipView.setVisibility(View.VISIBLE);
}
 
源代码7 项目: iBeebo   文件: WriteWeiboWithAppSrcActivity.java
private void showViewWithAnim(View view) {
        mSmileyPicker.setVisibility(View.VISIBLE);

        Animation animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0,
                Animation.RELATIVE_TO_SELF, 1, Animation.RELATIVE_TO_SELF, 0);
        animation.setDuration(150);
//        animation.setFillAfter(true);

        view.startAnimation(animation);

    }
 
源代码8 项目: direct-select-android   文件: DSListView.java
private void showListView() {
    if (animationInProgress || scrollInProgress || listViewIsShown) return;
    listView.setEnabled(true);
    animationInProgress = true;

    this.setVisibility(View.VISIBLE);
    this.bringToFront();
    this.readyToHide = false;

    // Scale picker box if animations enabled
    if (selectorAnimationsEnabled && null != this.pickerBox) {
        ScaleAnimation scaleAnimation = new ScaleAnimation(1f, 1f + scaleFactorDelta, 1f, 1f + scaleFactorDelta,
                Animation.RELATIVE_TO_SELF, selectorAnimationCenterPivot ? 0.5f : 0f, Animation.RELATIVE_TO_SELF, 0.5f);
        scaleAnimation.setInterpolator(new AccelerateInterpolator());
        scaleAnimation.setDuration(100);
        scaleAnimation.setFillAfter(true);
        this.pickerBox.getCellRoot().startAnimation(scaleAnimation);
    }

    // Show picker view animation
    AlphaAnimation showAnimation = new AlphaAnimation(0f, 1f);
    showAnimation.setDuration(200);
    showAnimation.setInterpolator(new AccelerateInterpolator());
    showAnimation.setAnimationListener(new AnimationListenerAdapter() {
        @Override
        public void onAnimationEnd(Animation animation) {
            animationInProgress = false;
            listViewIsShown = true;
            hideListView();
        }
    });

    this.startAnimation(showAnimation);
}
 
private void initAnim() {
	animShow = new TranslateAnimation(
			Animation.RELATIVE_TO_SELF, 0,
			Animation.RELATIVE_TO_SELF, 0,
			Animation.RELATIVE_TO_SELF, 1,
			Animation.RELATIVE_TO_SELF, 0);
	animShow.setDuration(300);

	animHide = new TranslateAnimation(
			Animation.RELATIVE_TO_SELF, 0,
			Animation.RELATIVE_TO_SELF, 0,
			Animation.RELATIVE_TO_SELF, 0,
			Animation.RELATIVE_TO_SELF, 1);
	animHide.setDuration(300);
}
 
源代码10 项目: GithubApp   文件: PlatformPage.java
private void initAnims() {
	animShow = new TranslateAnimation(
			Animation.RELATIVE_TO_SELF, 0,
			Animation.RELATIVE_TO_SELF, 0,
			Animation.RELATIVE_TO_SELF, 1,
			Animation.RELATIVE_TO_SELF, 0);
	animShow.setDuration(300);

	animHide = new TranslateAnimation(
			Animation.RELATIVE_TO_SELF, 0,
			Animation.RELATIVE_TO_SELF, 0,
			Animation.RELATIVE_TO_SELF, 0,
			Animation.RELATIVE_TO_SELF, 1);
	animHide.setDuration(300);
}
 
源代码11 项目: SprintNBA   文件: RotateImageView.java
/**
 * 设置动画效果
 */
private void setRotateAnimation() {
    if (mIsHasAnimation == false && getWidth() > 0 && getVisibility() == View.VISIBLE) {
        mIsHasAnimation = true;
        mAnimation = new RotateAnimation(0f, 359f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
        mAnimation.setDuration(1000L);
        mAnimation.setInterpolator(new LinearInterpolator());
        mAnimation.setRepeatCount(-1);
        mAnimation.setRepeatMode(Animation.RESTART);
        setAnimation(mAnimation);
    }
}
 
源代码12 项目: SprintNBA   文件: NormalListDialog.java
private void init() {
    widthScale(0.8f);

    /** LayoutAnimation */
    TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 2f, Animation.RELATIVE_TO_SELF,
            0f, Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0);
    animation.setInterpolator(new DecelerateInterpolator());
    animation.setDuration(550);

    mLac = new LayoutAnimationController(animation, 0.12f);
    mLac.setInterpolator(new DecelerateInterpolator());
}
 
@SuppressWarnings("SameParameterValue")
private void openMultiConnectPanel(final boolean isOpen, boolean animated) {

    // Check if already in the right position
    if ((mMultiConnectPanelView.getVisibility() == View.VISIBLE && isOpen) || (mMultiConnectPanelView.getVisibility() == View.GONE && !isOpen)) {
        return;
    }

    // Animate changes
    final long animationDuration = animated ? 300 : 0;

    RotateAnimation rotate = new RotateAnimation(isOpen ? -90 : 0, isOpen ? 0 : -90, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    rotate.setDuration(animationDuration);
    rotate.setInterpolator(new LinearInterpolator());
    rotate.setFillAfter(true);
    mMultiConnectExpandImageView.startAnimation(rotate);

    mMultiConnectPanelView.setVisibility(isOpen ? View.VISIBLE : View.GONE);
    mMultiConnectPanelView.animate()
            .alpha(isOpen ? 1.0f : 0)
            .setDuration(isOpen ? animationDuration : 0)
            .setListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    super.onAnimationEnd(animation);
                    mMultiConnectPanelView.setVisibility(isOpen ? View.VISIBLE : View.GONE);
                }
            });

}
 
源代码14 项目: deltachat-android   文件: MicrophoneRecorderView.java
public void hide(float x) {
  this.lastPositionX = x;

  float offset = getOffset(x);

  AnimationSet animation = new AnimationSet(false);
  Animation scaleAnimation = new ScaleAnimation(1, 0.5f, 1, 0.5f,
                                                Animation.RELATIVE_TO_SELF, 0.5f,
                                                Animation.RELATIVE_TO_SELF, 0.5f);

  Animation translateAnimation = new TranslateAnimation(Animation.ABSOLUTE, offset,
                                                        Animation.ABSOLUTE, 0,
                                                        Animation.RELATIVE_TO_SELF, -.25f,
                                                        Animation.RELATIVE_TO_SELF, -.25f);

  scaleAnimation.setInterpolator(new AnticipateOvershootInterpolator(1.5f));
  translateAnimation.setInterpolator(new DecelerateInterpolator());
  animation.addAnimation(scaleAnimation);
  animation.addAnimation(translateAnimation);
  animation.setDuration(ANIMATION_DURATION);
  animation.setFillBefore(true);
  animation.setFillAfter(false);
  animation.setInterpolator(new AnticipateOvershootInterpolator(1.5f));

  recordButtonFab.setVisibility(View.GONE);
  recordButtonFab.clearAnimation();
  recordButtonFab.startAnimation(animation);
}
 
private void showTagGroup() {
    if (mTagList.isEmpty()) {
        ToastUtils.showToast(getString(R.string.network_error_tips));
        return;
    }
    Animation mShowAction = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f,
            Animation.RELATIVE_TO_SELF, 0.0f,
            Animation.RELATIVE_TO_SELF, -1.0f,
            Animation.RELATIVE_TO_SELF, 0.0f);
    mShowAction.setDuration(400);
    rsvTags.startAnimation(mShowAction);
    rsvTags.setVisibility(View.VISIBLE);
}
 
源代码16 项目: Auie   文件: UIListView.java
private void initView() {
	
	mContainer = new LinearLayout(getContext());
	mContainer.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, 0));
	mContainer.setGravity(Gravity.BOTTOM);
	
	mContent = new LinearLayout(getContext());
	mContent.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, UEMethod.dp2px(getContext(), 60)));
	mContent.setOrientation(LinearLayout.HORIZONTAL);
	mContent.setGravity(Gravity.CENTER);
	
	RelativeLayout imageLayout = new RelativeLayout(getContext());
	imageLayout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT));
	
	int size = UEMethod.dp2px(getContext(), 36);
	RelativeLayout.LayoutParams params1 = new RelativeLayout.LayoutParams(size, size);
	params1.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
	mArrowImageView = new ImageView(getContext());
	mArrowImageView.setLayoutParams(params1);
	
	mProgressBar = new UILoadingBar(getContext());
	mProgressBar.setLayoutParams(params1);
	mProgressBar.setType(UILoadingBar.TYPE_SECTORE_THREE);
	
	LinearLayout.LayoutParams params2 = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
	params2.setMargins(UEMethod.dp2px(getContext(), 10), 0, 0, 0);
	LinearLayout textLayout = new LinearLayout(getContext());
	textLayout.setLayoutParams(params2);
	textLayout.setGravity(Gravity.CENTER_VERTICAL);
	textLayout.setOrientation(LinearLayout.VERTICAL);
	
	LinearLayout.LayoutParams params3 = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
	mHintTextView = new TextView(getContext());
	mHintTextView.setLayoutParams(params3);
	mHintTextView.setTextSize(12);
	mHintTextView.setText(STRING_NORMAL);
	mHintTextView.setTextColor(Color.parseColor("#777777"));
	
	mTimeTextView = new TextView(getContext());
	mTimeTextView.setLayoutParams(params3);
	mTimeTextView.setTextSize(10);
	mTimeTextView.setTextColor(Color.parseColor("#777777"));
	
	textLayout.addView(mHintTextView);
	textLayout.addView(mTimeTextView);
	imageLayout.addView(mArrowImageView);
	imageLayout.addView(mProgressBar);
	mContent.addView(imageLayout);
	mContent.addView(textLayout);
	mContainer.addView(mContent);
	addView(mContainer);
	
	setState(STATE_NORMAL);
		
	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);
}
 
源代码17 项目: sctalk   文件: IndicatorLayout.java
public IndicatorLayout(Context context, PullToRefreshBase.Mode mode) {
		super(context);
		mArrowImageView = new ImageView(context);

//		Drawable arrowD = getResources().getDrawable(R.drawable.indicator_arrow);
		Drawable arrowD = new Drawable() {
			
			@Override
			public void setColorFilter(ColorFilter cf) {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public void setAlpha(int alpha) {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public int getOpacity() {
				// TODO Auto-generated method stub
				return 0;
			}
			
			@Override
			public void draw(Canvas canvas) {
				// TODO Auto-generated method stub
				
			}
		};
		mArrowImageView.setImageDrawable(arrowD);

//		final int padding = getResources().getDimensionPixelSize(R.dimen.indicator_internal_padding);
		final int padding = 0;
		mArrowImageView.setPadding(padding, padding, padding, padding);
//		addView(mArrowImageView);

		int inAnimResId, outAnimResId;
		switch (mode) {
			case PULL_FROM_END:
				inAnimResId = R.anim.slide_in_from_bottom;
				outAnimResId = R.anim.slide_out_to_bottom;
				setBackgroundResource(R.drawable.indicator_bg_bottom);

				// Rotate Arrow so it's pointing the correct way
				mArrowImageView.setScaleType(ScaleType.MATRIX);
				Matrix matrix = new Matrix();
				matrix.setRotate(180f, arrowD.getIntrinsicWidth() / 2f, arrowD.getIntrinsicHeight() / 2f);
				mArrowImageView.setImageMatrix(matrix);
				break;
			default:
			case PULL_FROM_START:
				inAnimResId = R.anim.slide_in_from_top;
				outAnimResId = R.anim.slide_out_to_top;
				setBackgroundResource(R.drawable.indicator_bg_top);
				break;
		}

		mInAnim = AnimationUtils.loadAnimation(context, inAnimResId);
		mInAnim.setAnimationListener(this);

		mOutAnim = AnimationUtils.loadAnimation(context, outAnimResId);
		mOutAnim.setAnimationListener(this);

		final Interpolator interpolator = new LinearInterpolator();
		mRotateAnimation = new RotateAnimation(0, -180, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
				0.5f);
		mRotateAnimation.setInterpolator(interpolator);
		mRotateAnimation.setDuration(DEFAULT_ROTATION_ANIMATION_DURATION);
		mRotateAnimation.setFillAfter(true);

		mResetRotateAnimation = new RotateAnimation(-180, 0, Animation.RELATIVE_TO_SELF, 0.5f,
				Animation.RELATIVE_TO_SELF, 0.5f);
		mResetRotateAnimation.setInterpolator(interpolator);
		mResetRotateAnimation.setDuration(DEFAULT_ROTATION_ANIMATION_DURATION);
		mResetRotateAnimation.setFillAfter(true);

	}
 
源代码18 项目: NetEasyNews   文件: IndicatorLayout.java
public IndicatorLayout(Context context, PullToRefreshBase.Mode mode) {
	super(context);
	mArrowImageView = new ImageView(context);

	Drawable arrowD = getResources().getDrawable(R.drawable.indicator_arrow);
	mArrowImageView.setImageDrawable(arrowD);

	final int padding = getResources().getDimensionPixelSize(R.dimen.indicator_internal_padding);
	mArrowImageView.setPadding(padding, padding, padding, padding);
	addView(mArrowImageView);

	int inAnimResId, outAnimResId;
	switch (mode) {
		case PULL_FROM_END:
			inAnimResId = R.anim.slide_in_from_bottom;
			outAnimResId = R.anim.slide_out_to_bottom;
			setBackgroundResource(R.drawable.indicator_bg_bottom);

			// Rotate Arrow so it's pointing the correct way
			mArrowImageView.setScaleType(ScaleType.MATRIX);
			Matrix matrix = new Matrix();
			matrix.setRotate(180f, arrowD.getIntrinsicWidth() / 2f, arrowD.getIntrinsicHeight() / 2f);
			mArrowImageView.setImageMatrix(matrix);
			break;
		default:
		case PULL_FROM_START:
			inAnimResId = R.anim.slide_in_from_top;
			outAnimResId = R.anim.slide_out_to_top;
			setBackgroundResource(R.drawable.indicator_bg_top);
			break;
	}

	mInAnim = AnimationUtils.loadAnimation(context, inAnimResId);
	mInAnim.setAnimationListener(this);

	mOutAnim = AnimationUtils.loadAnimation(context, outAnimResId);
	mOutAnim.setAnimationListener(this);

	final Interpolator interpolator = new LinearInterpolator();
	mRotateAnimation = new RotateAnimation(0, -180, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
			0.5f);
	mRotateAnimation.setInterpolator(interpolator);
	mRotateAnimation.setDuration(DEFAULT_ROTATION_ANIMATION_DURATION);
	mRotateAnimation.setFillAfter(true);

	mResetRotateAnimation = new RotateAnimation(-180, 0, Animation.RELATIVE_TO_SELF, 0.5f,
			Animation.RELATIVE_TO_SELF, 0.5f);
	mResetRotateAnimation.setInterpolator(interpolator);
	mResetRotateAnimation.setDuration(DEFAULT_ROTATION_ANIMATION_DURATION);
	mResetRotateAnimation.setFillAfter(true);

}
 
源代码19 项目: bmob-android-demo-paging   文件: IndicatorLayout.java
public IndicatorLayout(Context context, PullToRefreshBase.Mode mode) {
	super(context);
	mArrowImageView = new ImageView(context);

	Drawable arrowD = getResources().getDrawable(R.drawable.indicator_arrow);
	mArrowImageView.setImageDrawable(arrowD);

	final int padding = getResources().getDimensionPixelSize(R.dimen.indicator_internal_padding);
	mArrowImageView.setPadding(padding, padding, padding, padding);
	addView(mArrowImageView);

	int inAnimResId, outAnimResId;
	switch (mode) {
		case PULL_FROM_END:
			inAnimResId = R.anim.slide_in_from_bottom;
			outAnimResId = R.anim.slide_out_to_bottom;
			setBackgroundResource(R.drawable.indicator_bg_bottom);

			// Rotate Arrow so it's pointing the correct way
			mArrowImageView.setScaleType(ScaleType.MATRIX);
			Matrix matrix = new Matrix();
			matrix.setRotate(180f, arrowD.getIntrinsicWidth() / 2f, arrowD.getIntrinsicHeight() / 2f);
			mArrowImageView.setImageMatrix(matrix);
			break;
		default:
		case PULL_FROM_START:
			inAnimResId = R.anim.slide_in_from_top;
			outAnimResId = R.anim.slide_out_to_top;
			setBackgroundResource(R.drawable.indicator_bg_top);
			break;
	}

	mInAnim = AnimationUtils.loadAnimation(context, inAnimResId);
	mInAnim.setAnimationListener(this);

	mOutAnim = AnimationUtils.loadAnimation(context, outAnimResId);
	mOutAnim.setAnimationListener(this);

	final Interpolator interpolator = new LinearInterpolator();
	mRotateAnimation = new RotateAnimation(0, -180, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
			0.5f);
	mRotateAnimation.setInterpolator(interpolator);
	mRotateAnimation.setDuration(DEFAULT_ROTATION_ANIMATION_DURATION);
	mRotateAnimation.setFillAfter(true);

	mResetRotateAnimation = new RotateAnimation(-180, 0, Animation.RELATIVE_TO_SELF, 0.5f,
			Animation.RELATIVE_TO_SELF, 0.5f);
	mResetRotateAnimation.setInterpolator(interpolator);
	mResetRotateAnimation.setDuration(DEFAULT_ROTATION_ANIMATION_DURATION);
	mResetRotateAnimation.setFillAfter(true);

}
 
源代码20 项目: RefreashTabView   文件: IndicatorLayout.java
public IndicatorLayout(Context context, PullToRefreshBase.Mode mode) {
	super(context);
	mArrowImageView = new ImageView(context);

	Drawable arrowD = getResources().getDrawable(R.drawable.indicator_arrow);
	mArrowImageView.setImageDrawable(arrowD);

	final int padding = getResources().getDimensionPixelSize(R.dimen.indicator_internal_padding);
	mArrowImageView.setPadding(padding, padding, padding, padding);
	addView(mArrowImageView);

	int inAnimResId, outAnimResId;
	switch (mode) {
		case PULL_FROM_END:
			inAnimResId = R.anim.slide_in_from_bottom;
			outAnimResId = R.anim.slide_out_to_bottom;
			setBackgroundResource(R.drawable.indicator_bg_bottom);

			// Rotate Arrow so it's pointing the correct way
			mArrowImageView.setScaleType(ScaleType.MATRIX);
			Matrix matrix = new Matrix();
			matrix.setRotate(180f, arrowD.getIntrinsicWidth() / 2f, arrowD.getIntrinsicHeight() / 2f);
			mArrowImageView.setImageMatrix(matrix);
			break;
		default:
		case PULL_FROM_START:
			inAnimResId = R.anim.slide_in_from_top;
			outAnimResId = R.anim.slide_out_to_top;
			setBackgroundResource(R.drawable.indicator_bg_top);
			break;
	}

	mInAnim = AnimationUtils.loadAnimation(context, inAnimResId);
	mInAnim.setAnimationListener(this);

	mOutAnim = AnimationUtils.loadAnimation(context, outAnimResId);
	mOutAnim.setAnimationListener(this);

	final Interpolator interpolator = new LinearInterpolator();
	mRotateAnimation = new RotateAnimation(0, -180, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
			0.5f);
	mRotateAnimation.setInterpolator(interpolator);
	mRotateAnimation.setDuration(DEFAULT_ROTATION_ANIMATION_DURATION);
	mRotateAnimation.setFillAfter(true);

	mResetRotateAnimation = new RotateAnimation(-180, 0, Animation.RELATIVE_TO_SELF, 0.5f,
			Animation.RELATIVE_TO_SELF, 0.5f);
	mResetRotateAnimation.setInterpolator(interpolator);
	mResetRotateAnimation.setDuration(DEFAULT_ROTATION_ANIMATION_DURATION);
	mResetRotateAnimation.setFillAfter(true);

}