Java Code Examples for android.view.animation.RotateAnimation#RELATIVE_TO_SELF
The following examples show how to use
android.view.animation.RotateAnimation#RELATIVE_TO_SELF .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PullToRefreshView.java From UltimateAndroid with Apache License 2.0 | 6 votes |
/** * init * * @param * @description */ private void init() { // Load all of the animations we need in code rather than through XML 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); mInflater = LayoutInflater.from(getContext()); // header view 在此添加,保证是第一个添加到linearlayout的最上端 addHeaderView(); }
Example 2
Source File: PullToRefreshView.java From Huochexing12306 with Apache License 2.0 | 6 votes |
/** * init * * @description * @param context * hylin 2012-7-26上午10:08:33 */ private void init() { // Load all of the animations we need in code rather than through XML 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); mInflater = LayoutInflater.from(getContext()); // header view 在此添加,保证是第一个添加到linearlayout的最上端 addHeaderView(); }
Example 3
Source File: PullToRefreshView.java From wallpaper with GNU General Public License v2.0 | 6 votes |
/** * init * * @description * @param context * hylin 2012-7-26上午10:08:33 */ private void init() { // Load all of the animations we need in code rather than through XML 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); mInflater = LayoutInflater.from(getContext()); // header view 在此添加,保证是第一个添加到linearlayout的最上端 addHeaderView(); }
Example 4
Source File: TraditionFooterAdapter.java From UltimateRefreshView with Apache License 2.0 | 5 votes |
public TraditionFooterAdapter(Context context) { super(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); }
Example 5
Source File: PtrClassicDefaultHeader.java From LiveSourceCode with Apache License 2.0 | 5 votes |
private void buildAnimation() { mFlipAnimation = new RotateAnimation(0, -180, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f); mFlipAnimation.setInterpolator(new LinearInterpolator()); mFlipAnimation.setDuration(mRotateAniTime); 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(mRotateAniTime); mReverseFlipAnimation.setFillAfter(true); }
Example 6
Source File: MainActivity.java From AndroidHeros with MIT License | 5 votes |
public void btnRotateSelf(View view) { RotateAnimation ra = new RotateAnimation(0, 360, RotateAnimation.RELATIVE_TO_SELF, 0.5F, RotateAnimation.RELATIVE_TO_SELF, 0.5F); ra.setDuration(1000); view.startAnimation(ra); }
Example 7
Source File: PullListView.java From PullListView with GNU General Public License v2.0 | 5 votes |
/** * 初始化动画 */ private void initAnimation() { // 旋转 animation = new RotateAnimation(-180, 0, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f); animation.setInterpolator(new LinearInterpolator()); animation.setDuration(300); animation.setFillAfter(true); //反向旋转 reverseAnimation = new RotateAnimation(0, -180, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f); reverseAnimation.setInterpolator(new LinearInterpolator()); reverseAnimation.setDuration(300); reverseAnimation.setFillAfter(true); }
Example 8
Source File: MainActivity.java From Study_Android_Demo with Apache License 2.0 | 5 votes |
public void rotateAnim_java(View view) { // 2.����RotateAnimation RotateAnimation animation = new RotateAnimation(-45f, 45f, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0f); animation.setDuration(1000); animation.setRepeatCount(Animation.INFINITE); animation.setRepeatMode(Animation.REVERSE); animation.setInterpolator(new LinearInterpolator()); // 3.���Ŷ��� iv_rocket.startAnimation(animation); }
Example 9
Source File: VerticalParentViewHolder.java From bleYan with GNU General Public License v2.0 | 5 votes |
@Override public void onExpansionToggled(boolean isExpanded) { super.onExpansionToggled(isExpanded); if (!HONEYCOMB_AND_ABOVE) { return; } RotateAnimation rotateAnimation = new RotateAnimation(ROTATED_POSITION, INITIAL_POSITION, RotateAnimation.RELATIVE_TO_SELF, PIVOT_VALUE, RotateAnimation.RELATIVE_TO_SELF, PIVOT_VALUE); rotateAnimation.setDuration(DEFAULT_ROTATE_DURATION_MS); rotateAnimation.setFillAfter(true); mArrowExpandImageView.startAnimation(rotateAnimation); }
Example 10
Source File: TraditionHeaderAdapter.java From UltimateRefreshView with Apache License 2.0 | 5 votes |
public TraditionHeaderAdapter(Context context) { super(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); }
Example 11
Source File: DynamicListAnimationUtils.java From dynamiclistview with MIT License | 5 votes |
public static void rotationAnimation(View view, AnimationListener listener) { if(view==null) return; final RotateAnimation rotation = new RotateAnimation(0, 180, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f); rotation.setDuration(300); rotation.setFillAfter(true); if(listener!=null) rotation.setAnimationListener(listener); view.startAnimation(rotation); }
Example 12
Source File: AbsClassicRefreshView.java From SmoothRefreshLayout with MIT License | 5 votes |
public AbsClassicRefreshView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); mStyle = new me.dkzwm.widget.srl.extra.RefreshViewStyle(context, attrs, defStyleAttr, 0); mFlipAnimation = new RotateAnimation( 0, -180, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f); mFlipAnimation.setInterpolator(sLinearInterpolator); mFlipAnimation.setDuration(mRotateAniTime); mFlipAnimation.setFillAfter(true); mReverseFlipAnimation = new RotateAnimation( -180, 0, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f); mReverseFlipAnimation.setInterpolator(sLinearInterpolator); mReverseFlipAnimation.setDuration(mRotateAniTime); mReverseFlipAnimation.setFillAfter(true); createClassicViews(); mArrowImageView = findViewById(R.id.sr_classic_arrow); mTitleTextView = findViewById(R.id.sr_classic_title); mLastUpdateTextView = findViewById(R.id.sr_classic_last_update); mProgressBar = findViewById(R.id.sr_classic_progress); mLastUpdateTimeUpdater = new LastUpdateTimeUpdater(this); mArrowImageView.clearAnimation(); mArrowImageView.setVisibility(VISIBLE); mProgressBar.setVisibility(INVISIBLE); }
Example 13
Source File: PtrClassicDefaultHeader.java From Swface with Apache License 2.0 | 5 votes |
private void buildAnimation() { mFlipAnimation = new RotateAnimation(0, -180, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f); mFlipAnimation.setInterpolator(new LinearInterpolator()); mFlipAnimation.setDuration(mRotateAniTime); 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(mRotateAniTime); mReverseFlipAnimation.setFillAfter(true); }
Example 14
Source File: PtrClassicDefaultHeader.java From CommonPullToRefresh with Apache License 2.0 | 5 votes |
private void buildAnimation() { mFlipAnimation = new RotateAnimation(0, -180, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f); mFlipAnimation.setInterpolator(new LinearInterpolator()); mFlipAnimation.setDuration(mRotateAniTime); 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(mRotateAniTime); mReverseFlipAnimation.setFillAfter(true); }
Example 15
Source File: AboutActivity.java From AndroidPlusJava with GNU General Public License v3.0 | 5 votes |
@OnClick(R.id.about_info) public void onViewClicked() { RotateAnimation rotateAnimation = new RotateAnimation(0, 1080, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f); rotateAnimation.setDuration(1000); rotateAnimation.setInterpolator(new AccelerateInterpolator()); mAboutInfo.startAnimation(rotateAnimation); }
Example 16
Source File: RefreshHeader.java From RecyclerViewManager with MIT License | 5 votes |
private void buildAnimation() { mFlipAnimation = new RotateAnimation(0, -180, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f); mFlipAnimation.setInterpolator(new LinearInterpolator()); mFlipAnimation.setDuration(mRotateAniTime); 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(mRotateAniTime); mReverseFlipAnimation.setFillAfter(true); }
Example 17
Source File: HorizontalParentViewHolder.java From expandable-recycler-view with MIT License | 5 votes |
@Override public void onExpansionToggled(boolean expanded) { super.onExpansionToggled(expanded); if (!HONEYCOMB_AND_ABOVE) { return; } RotateAnimation rotateAnimation = new RotateAnimation(ROTATED_POSITION, INITIAL_POSITION, RotateAnimation.RELATIVE_TO_SELF, PIVOT_VALUE, RotateAnimation.RELATIVE_TO_SELF, PIVOT_VALUE); rotateAnimation.setDuration(DEFAULT_ROTATE_DURATION_MS); rotateAnimation.setFillAfter(true); mArrowExpandImageView.startAnimation(rotateAnimation); }
Example 18
Source File: EBounceViewHeader.java From appcan-android with GNU Lesser General Public License v3.0 | 4 votes |
public EBounceViewHeader(Context context, int type) { super(context); setWillNotDraw(true); setBackgroundColor(0); setFocusable(false); ESystemInfo intence = ESystemInfo.getIntence(); int height = intence.mDefaultBounceHeight; RelativeLayout wapper = new RelativeLayout(context); wapper.setWillNotDraw(true); wapper.setBackgroundColor(0); wapper.setFocusable(false); RelativeLayout.LayoutParams wParm = new LayoutParams(-1, height); if (type == EViewEntry.F_BOUNCE_TYPE_TOP) { wParm.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); } else { wParm.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE); } wapper.setLayoutParams(wParm); addView(wapper); wap = new RelativeLayout(context); wap.setId(F_WAP_ID); RelativeLayout.LayoutParams wm = new LayoutParams(-2, height); wm.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE); wm.leftMargin = 30; wap.setLayoutParams(wm); mContent = new TextView(context); mContent.setId(F_CONTENT_ID); RelativeLayout.LayoutParams parmMsg = new LayoutParams(-2, -2); parmMsg.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE); mContent.setLayoutParams(parmMsg); mContent.setTextColor(textColor); mContent.setText(pullToReloadText); mContent.setTextSize(TypedValue.COMPLEX_UNIT_DIP, (float) (intence.mDefaultNatvieFontSize)); mContent.setVisibility(GONE); wap.addView(mContent); mLevelContent = new TextView(context); RelativeLayout.LayoutParams parml = new LayoutParams(-2, -2); parml.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE); parml.addRule(RelativeLayout.BELOW, F_CONTENT_ID); mLevelContent.setLayoutParams(parml); mLevelContent.setTextColor(textColor); mLevelContent.setTextSize(TypedValue.COMPLEX_UNIT_DIP, (float) (intence.mDefaultNatvieFontSize * 0.6)); mLevelContent.setVisibility(GONE); wap.addView(mLevelContent); wapper.addView(wap); mProgress = new ProgressBar(context); mProgress.setIndeterminate(true); int use = height - 12; RelativeLayout.LayoutParams parmPro = new LayoutParams(use, use); parmPro.addRule(RelativeLayout.LEFT_OF, F_WAP_ID); parmPro.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE); mProgress.setLayoutParams(parmPro); mProgress.setVisibility(GONE); wapper.addView(mProgress); mYAxisProgress = new YAxisImageView(context); int useY = height - 12; RelativeLayout.LayoutParams parmProY = new LayoutParams(useY, useY); parmProY.addRule(RelativeLayout.LEFT_OF, F_WAP_ID); parmProY.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE); mYAxisProgress.setLayoutParams(parmProY); mYAxisProgress.setVisibility(GONE); wapper.addView(mYAxisProgress); mArrowImage = new ImageView(context); int useA = height - 12; RelativeLayout.LayoutParams parmImage = new LayoutParams(useA, useA); parmImage.addRule(RelativeLayout.LEFT_OF, F_WAP_ID); parmImage.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE); mArrowImage.setLayoutParams(parmImage); Drawable icon = context.getResources().getDrawable(EResources.platform_myspace_pulltorefresh_arrow); mArrowImage.setImageDrawable(icon); mArrowImage.setVisibility(GONE); wapper.addView(mArrowImage); mAnimationUp = new RotateAnimation(-180, 0, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f); mAnimationUp.setInterpolator(new AccelerateInterpolator()); mAnimationUp.setDuration(250); mAnimationUp.setFillAfter(true); mAnimationDown = new RotateAnimation(0, -180, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f); mAnimationDown.setInterpolator(new AccelerateInterpolator()); mAnimationDown.setDuration(250); mAnimationDown.setFillAfter(true); }
Example 19
Source File: DropDownListView.java From UltimateAndroid with Apache License 2.0 | 4 votes |
/** * init drop down style, only init once */ private void initDropDownStyle() { if (headerLayout != null) { if (isDropDownStyle) { addHeaderView(headerLayout); } else { removeHeaderView(headerLayout); } return; } if (!isDropDownStyle) { return; } headerReleaseMinDistance = context.getResources().getDimensionPixelSize( R.dimen.drop_down_list_header_release_min_distance); flipAnimation = new RotateAnimation(0, 180, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f); flipAnimation.setInterpolator(new LinearInterpolator()); flipAnimation.setDuration(250); flipAnimation.setFillAfter(true); reverseFlipAnimation = new RotateAnimation(-180, 0, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f); reverseFlipAnimation.setInterpolator(new LinearInterpolator()); reverseFlipAnimation.setDuration(250); reverseFlipAnimation.setFillAfter(true); headerDefaultText = context.getString(R.string.drop_down_list_header_default_text); headerPullText = context.getString(R.string.drop_down_list_header_pull_text); headerReleaseText = context.getString(R.string.drop_down_list_header_release_text); headerLoadingText = context.getString(R.string.drop_down_list_header_loading_text); LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); headerLayout = (RelativeLayout)inflater.inflate(R.layout.drop_down_list_header, this, false); headerText = (TextView)headerLayout.findViewById(R.id.drop_down_list_header_default_text); headerImage = (ImageView)headerLayout.findViewById(R.id.drop_down_list_header_image); headerProgressBar = (ProgressBar)headerLayout.findViewById(R.id.drop_down_list_header_progress_bar); headerSecondText = (TextView)headerLayout.findViewById(R.id.drop_down_list_header_second_text); headerLayout.setClickable(true); headerLayout.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { onDropDown(); } }); headerText.setText(headerDefaultText); addHeaderView(headerLayout); measureHeaderLayout(headerLayout); headerOriginalHeight = headerLayout.getMeasuredHeight(); headerOriginalTopPadding = headerLayout.getPaddingTop(); currentHeaderStatus = HEADER_STATUS_CLICK_TO_LOAD; }
Example 20
Source File: BasicAnimationDemoActivity.java From AnimationApiDemos with Apache License 2.0 | 4 votes |
private void initAnimations() { mTurnupAnimation = new RotateAnimation(0, -180, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f); mTurnupAnimation.setInterpolator(new LinearInterpolator()); mTurnupAnimation.setDuration(500); mTurnupAnimation.setFillAfter(true); mTurndownAnimation = new RotateAnimation(-180, 0, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f); mTurndownAnimation.setInterpolator(new LinearInterpolator()); mTurndownAnimation.setDuration(500); mTurndownAnimation.setFillAfter(true); mTranslateAnimationOne = new TranslateAnimation(0, 100, 0, 100); mTranslateAnimationOne .setInterpolator(new AccelerateDecelerateInterpolator()); mTranslateAnimationOne.setDuration(1000); mTranslateAnimationOne.setFillAfter(true); mTranslateAnimationTwo = new TranslateAnimation(100, 100, 0, 100); mTranslateAnimationTwo .setInterpolator(new AccelerateDecelerateInterpolator()); mTranslateAnimationTwo.setDuration(1000); mTranslateAnimationTwo.setFillAfter(true); mAlphaAnimationOne = new AlphaAnimation(1, 0); mAlphaAnimationOne.setDuration(500); mAlphaAnimationOne.setFillAfter(true); mAlphaAnimationTwo = new AlphaAnimation(0, 1); mAlphaAnimationTwo.setDuration(1000); mAlphaAnimationTwo.setStartOffset(500); mAlphaAnimationTwo.setFillAfter(true); mAlphaAnimationSet = new AnimationSet(false); mAlphaAnimationSet.addAnimation(mAlphaAnimationOne); mAlphaAnimationSet.addAnimation(mAlphaAnimationTwo); mAlphaAnimationSet.setDuration(5000); mAlphaAnimationSet.setFillAfter(true); mScaleAnimation = new ScaleAnimation(1, 1.5f, 1, 1.5f); mScaleAnimation.setDuration(1000); mScaleAnimation.setFillAfter(true); }