当前位置: 首页>>代码示例>>Java>>正文


Java View.startAnimation方法代码示例

本文整理汇总了Java中android.view.View.startAnimation方法的典型用法代码示例。如果您正苦于以下问题:Java View.startAnimation方法的具体用法?Java View.startAnimation怎么用?Java View.startAnimation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.view.View的用法示例。


在下文中一共展示了View.startAnimation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onFocusChange

import android.view.View; //导入方法依赖的package包/类
@Override
public void onFocusChange(View v, boolean hasFocus) {

    int focus = 0;
    if (hasFocus) {
        focus = R.anim.enlarge;
    } else {
        focus = R.anim.decrease;
    }
    //如果有焦点就放大,没有焦点就缩小
    Animation mAnimation = AnimationUtils.loadAnimation(
            getActivity().getApplication(), focus);
    mAnimation.setBackgroundColor(Color.TRANSPARENT);
    mAnimation.setFillAfter(hasFocus);
    v.startAnimation(mAnimation);
    mAnimation.start();
    v.bringToFront();
}
 
开发者ID:Evan-Galvin,项目名称:FreeStreams-TVLauncher,代码行数:19,代码来源:WoDouGameBaseFragment.java

示例2: expand

import android.view.View; //导入方法依赖的package包/类
private static void expand(final View v) {
    v.measure(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    final int targetHeight = v.getMeasuredHeight();

    v.getLayoutParams().height = 0;
    v.setVisibility(View.VISIBLE);
    Animation a = new Animation() {
        @Override
        protected void applyTransformation(float interpolatedTime, Transformation t) {
            v.getLayoutParams().height = interpolatedTime == 1
                    ? LinearLayout.LayoutParams.WRAP_CONTENT
                    : (int) (targetHeight * interpolatedTime);
            v.requestLayout();
        }

        @Override
        public boolean willChangeBounds() {
            return true;
        }
    };

    // 1dp/ms
    a.setDuration((int) (targetHeight / v.getContext().getResources().getDisplayMetrics().density));
    v.startAnimation(a);
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:26,代码来源:AndroidTreeView.java

示例3: collapse

import android.view.View; //导入方法依赖的package包/类
public  void collapse(final View v) {
    final int initialHeight = v.getMeasuredHeight();

    Animation a = new Animation()
    {
        @Override
        protected void applyTransformation(float interpolatedTime, Transformation t) {
            if(interpolatedTime == 1){
                v.setVisibility(View.GONE);
            }else{
                v.getLayoutParams().height = initialHeight - (int)(initialHeight * interpolatedTime);
                v.requestLayout();
            }
        }

        @Override
        public boolean willChangeBounds() {
            return true;
        }
    };

    // 1dp/ms
    a.setDuration((int)(initialHeight / v.getContext().getResources().getDisplayMetrics().density));
    v.startAnimation(a);
}
 
开发者ID:appteam-nith,项目名称:Hillffair17,代码行数:26,代码来源:GalleryView.java

示例4: setSwipePosition

import android.view.View; //导入方法依赖的package包/类
/**
 * Sets the horizontal position and translucency of the view being swiped.
 */
@SuppressLint("NewApi")
private void setSwipePosition(View view, float deltaX) {
    float fraction = Math.abs(deltaX) / view.getWidth();
    if (isRuntimePostGingerbread()) {
        view.setTranslationX(deltaX);
        view.setAlpha(1 - fraction);
    } else {
        // Hello, Gingerbread!
        TranslateAnimation swipeAnim = new TranslateAnimation(deltaX, deltaX, 0, 0);
        mCurrentX = deltaX;
        mCurrentAlpha = (1 - fraction);
        AlphaAnimation alphaAnim = new AlphaAnimation(mCurrentAlpha, mCurrentAlpha);
        AnimationSet set = new AnimationSet(true);
        set.addAnimation(swipeAnim);
        set.addAnimation(alphaAnim);
        set.setFillAfter(true);
        set.setFillEnabled(true);
        view.startAnimation(set);
    }
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:24,代码来源:ListViewItemAnimations.java

示例5: animateHideView

import android.view.View; //导入方法依赖的package包/类
private void animateHideView(final int position) {
    final View view = viewList.get(position);

    FlipAnimation rotation = createFlipAnimation(0, -90, view.getWidth(), view.getHeight() / 2.0f);
    rotation.setAnimationListener(new FlipAnimationsListenerBase(view) {
        @Override
        public void onAnimationEnd(Animation animation) {
            super.onAnimationEnd(animation);

            view.setVisibility(View.INVISIBLE);
            if (position == viewList.size() - 1) {
                animatorListener.setViewsClickable(true);
                drawerLayout.closeDrawers();
            }
        }
    });

    view.startAnimation(rotation);
}
 
开发者ID:ABTSoftware,项目名称:SciChart.Android.Examples,代码行数:20,代码来源:ViewAnimator.java

示例6: a

import android.view.View; //导入方法依赖的package包/类
private View a(Context context) {
    View linearLayout = new LinearLayout(context);
    LayoutParams layoutParams = new FrameLayout.LayoutParams(-2, a(context, (float) IntFloatWheelView.DEFAULT_VALUE));
    layoutParams.gravity = 17;
    linearLayout.setOrientation(0);
    linearLayout.setLayoutParams(layoutParams);
    Drawable gradientDrawable = new GradientDrawable();
    gradientDrawable.setColor(-450944201);
    gradientDrawable.setCornerRadius((float) a(context, 5.0f));
    linearLayout.setBackgroundDrawable(gradientDrawable);
    View imageView = new ImageView(context);
    layoutParams = new LinearLayout.LayoutParams(a(context, 20.0f), a(context, 20.0f));
    layoutParams.gravity = 16;
    layoutParams.setMargins(a(this.a.f, 17.0f), a(this.a.f, 10.0f), a(this.a.f, 8.0f), a(this.a.f, 10.0f));
    imageView.setLayoutParams(layoutParams);
    imageView.setScaleType(ScaleType.FIT_CENTER);
    imageView.setImageDrawable(a(context, a.d));
    Animation rotateAnimation = new RotateAnimation(0.0f, 359.0f, 1, 0.5f, 1, 0.5f);
    rotateAnimation.setRepeatCount(-1);
    rotateAnimation.setDuration(900);
    rotateAnimation.setInterpolator(new LinearInterpolator());
    imageView.startAnimation(rotateAnimation);
    View textView = new TextView(context);
    textView.setText(TextUtils.isEmpty(this.a.g) ? a.a : this.a.g);
    textView.setTextSize(16.0f);
    textView.setTextColor(-1);
    layoutParams = new LinearLayout.LayoutParams(-2, -2);
    layoutParams.gravity = 16;
    layoutParams.setMargins(0, 0, a(context, 17.0f), 0);
    textView.setLayoutParams(layoutParams);
    linearLayout.addView(imageView);
    linearLayout.addView(textView);
    return linearLayout;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:35,代码来源:a.java

示例7: doExitAnim

import android.view.View; //导入方法依赖的package包/类
public void doExitAnim(final View contentView, long animDuration) {
    if (builder.gravity == Gravity.BOTTOM) {
        ValueAnimator exitAnimator = ValueAnimator.ofFloat(0, contentView.getHeight());
        exitAnimator.setDuration(animDuration);
        exitAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                float value = (float) animation.getAnimatedValue();
                contentView.setTranslationY(value);
            }
        });
        exitAnimator.start();
    } else {
        ScaleAnimation scaleAnimation = new ScaleAnimation(1.0F, 0.0F, 1.0F, 0.0F,
                Animation.RELATIVE_TO_PARENT, 0.5F, Animation.RELATIVE_TO_PARENT, 0.5F);
        scaleAnimation.setDuration(animDuration);
        scaleAnimation.setFillAfter(true);
        contentView.startAnimation(scaleAnimation);
    }
}
 
开发者ID:devilist,项目名称:RecyclerWheelPicker,代码行数:21,代码来源:WheelPicker.java

示例8: startAlphaRevealAnimation

import android.view.View; //导入方法依赖的package包/类
/**
 * For the Activity Circle Icon and text
 */

public static AnimationSet startAlphaRevealAnimation(final View VIEW) {
	final int ANIMATION_DURATION = 1000;

	final Animation mShowViewAnimation = new AlphaAnimation(0f, 1f);
	mShowViewAnimation.setDuration(ANIMATION_DURATION);

	AnimationSet mAnimations = new AnimationSet(true);
	mAnimations.setInterpolator(new AccelerateDecelerateInterpolator());
	mAnimations.addAnimation(mShowViewAnimation);
	mAnimations.setFillAfter(true);

       if(VIEW != null)
	    VIEW.startAnimation(mAnimations);

	return mAnimations;
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:21,代码来源:AnimationService.java

示例9: collapse

import android.view.View; //导入方法依赖的package包/类
public static void collapse(final View v) {
    final int initialHeight = v.getMeasuredHeight();

    Animation a = new Animation() {
        @Override
        protected void applyTransformation(float interpolatedTime, Transformation t) {
            if (interpolatedTime == 1) {
                v.setVisibility(View.GONE);
            } else {
                v.getLayoutParams().height = initialHeight - (int) (initialHeight * interpolatedTime);
                v.requestLayout();
            }
        }

        @Override
        public boolean willChangeBounds() {
            return true;
        }
    };

    // 1dp/ms
    a.setDuration((int) (initialHeight / v.getContext().getResources().getDisplayMetrics().density));
    v.startAnimation(a);
}
 
开发者ID:manuelsc,项目名称:Lunary-Ethereum-Wallet,代码行数:25,代码来源:CollapseAnimator.java

示例10: rotationAnim

import android.view.View; //导入方法依赖的package包/类
/**
 * Rotate ImageView
 *
 * @param view
 */
public static void rotationAnim(@NonNull View view) {
    RotateAnimation rotateAnimation1 = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f,
            Animation.RELATIVE_TO_SELF, 0.5f);
    rotateAnimation1.setInterpolator(new LinearInterpolator());
    rotateAnimation1.setDuration(300);
    rotateAnimation1.setRepeatCount(0);
    view.startAnimation(rotateAnimation1);
}
 
开发者ID:RajneeshSingh007,项目名称:MusicX-music-player,代码行数:14,代码来源:Helper.java

示例11: enableView

import android.view.View; //导入方法依赖的package包/类
public static void enableView(View v) {
    if (Build.VERSION.SDK_INT >= 11) {
        try {
            v.setAlpha(1.0f);
            return;
        } catch (Exception e) {
        }
    } else {
        enableAnim.setDuration(100);
        enableAnim.setFillAfter(true);
        v.startAnimation(enableAnim);
    }
}
 
开发者ID:eventtus,项目名称:photo-editor-android,代码行数:14,代码来源:UtilFunctions.java

示例12: setAnimation

import android.view.View; //导入方法依赖的package包/类
private void setAnimation(View viewToAnimate, int position) {
    // If the bound view wasn't previously displayed on screen, it's animated
    if (position > mLastPosition) {
        Animation animation = AnimationUtils.loadAnimation(mContext, android.R.anim.slide_in_left);
        viewToAnimate.startAnimation(animation);
        mLastPosition = position;
    }
}
 
开发者ID:victoraldir,项目名称:BuddyBook,代码行数:9,代码来源:BookGridAdapterFirebase.java

示例13: start

import android.view.View; //导入方法依赖的package包/类
private void start(Tuple match) {
    this.mRunningAnimation = match.mAnimation;
    View view = getTarget();
    if (view != null) {
        view.startAnimation(this.mRunningAnimation);
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:8,代码来源:StateListAnimator.java

示例14: openFABAnimation

import android.view.View; //导入方法依赖的package包/类
public void openFABAnimation(final View view, final View hint) {
    Animation slideUp = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.slide_up);

    // Listener changes visibility to GONE on finish
    view.setVisibility(View.VISIBLE);
    hint.setVisibility(View.VISIBLE);

    hint.startAnimation(slideUp);
    view.startAnimation(slideUp);
}
 
开发者ID:feelfreelinux,项目名称:WordLing,代码行数:11,代码来源:WordpacksListActivity.java

示例15: showLine

import android.view.View; //导入方法依赖的package包/类
public static void showLine(Context context, View top, View bottom) {
    Animation topTranslateAnimation=new TranslateAnimation(0, 0, -DensityUtil.dip2px(context, 56f), 0);
    topTranslateAnimation.setDuration(300);
    topTranslateAnimation.setInterpolator(context, android.R.anim.linear_interpolator);
    topTranslateAnimation.setFillAfter(true);
    top.startAnimation(topTranslateAnimation);

    Animation bottomTranslateAnimation=new TranslateAnimation(0, 0, DensityUtil.dip2px(context, 56f), 0);
    bottomTranslateAnimation.setDuration(300);
    bottomTranslateAnimation.setInterpolator(context, android.R.anim.linear_interpolator);
    bottomTranslateAnimation.setFillAfter(true);
    bottom.startAnimation(bottomTranslateAnimation);
    top.setVisibility(View.VISIBLE);
    bottom.setVisibility(View.VISIBLE);
}
 
开发者ID:BigSea001,项目名称:PhotoPickApp,代码行数:16,代码来源:AnimationUtil.java


注:本文中的android.view.View.startAnimation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。