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


Java AlphaAnimation类代码示例

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


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

示例1: setAdapterInsertAnimation

import android.view.animation.AlphaAnimation; //导入依赖的package包/类
public static void setAdapterInsertAnimation(final View aCard, int row, int height) {
	final int ANIMATION_DURATION = 650;
	final int BASE_DELAY = 50;

	TranslateAnimation translationAnimation = new TranslateAnimation(0,0, height,0);

	AlphaAnimation alphaAnimation = new AlphaAnimation(0f, 1f);

	final AnimationSet animationSet = new AnimationSet(true);
	animationSet.addAnimation(translationAnimation);
	animationSet.addAnimation(alphaAnimation);
	animationSet.setInterpolator(new AccelerateDecelerateInterpolator());
	animationSet.setFillAfter(true);
	animationSet.setFillBefore(true);
	animationSet.setDuration(ANIMATION_DURATION + row * BASE_DELAY);

	aCard.setAnimation(animationSet);
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:19,代码来源:AnimationService.java

示例2: createOptionShowAnimation

import android.view.animation.AlphaAnimation; //导入依赖的package包/类
@Override
public Animation createOptionShowAnimation(OptionButton optionButton, int index) {
    AnimationSet animationSet = new AnimationSet(true);
    TranslateAnimation translateAnimation= new TranslateAnimation(
            getYMenuButton().getX() - optionButton.getX()
            ,0
            ,getYMenuButton().getY() - optionButton.getY()
            ,0);
    translateAnimation.setDuration(getOptionSD_AnimationDuration());
    AlphaAnimation alphaAnimation = new AlphaAnimation(0,1);
    alphaAnimation.setDuration(getOptionSD_AnimationDuration());
    animationSet.addAnimation(alphaAnimation);
    animationSet.addAnimation(translateAnimation);
    //为不同的Option设置延时
    if (index % 2 == 1) {
        animationSet.setStartOffset(getOptionSD_AnimationDuration()/2);
    }
    return animationSet;
}
 
开发者ID:totond,项目名称:YMenuView,代码行数:20,代码来源:Circle8YMenu.java

示例3: setAlpha

import android.view.animation.AlphaAnimation; //导入依赖的package包/类
@SuppressLint("NewApi")
public ViewHolder setAlpha(int viewId, float value)
{
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
    {
        getView(viewId).setAlpha(value);
    } else
    {
        // Pre-honeycomb hack to set Alpha value
        AlphaAnimation alpha = new AlphaAnimation(value, value);
        alpha.setDuration(0);
        alpha.setFillAfter(true);
        getView(viewId).startAnimation(alpha);
    }
    return this;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:17,代码来源:ViewHolder.java

示例4: createOptionDisappearAnimation

import android.view.animation.AlphaAnimation; //导入依赖的package包/类
@Override
public Animation createOptionDisappearAnimation(OptionButton optionButton, int index) {

    AnimationSet animationSet = new AnimationSet(true);
    TranslateAnimation translateAnimation= new TranslateAnimation(
            0
            ,getYMenuButton().getX() - optionButton.getX()
            ,0
            ,getYMenuButton().getY() - optionButton.getY()
    );
    translateAnimation.setDuration(getOptionSD_AnimationDuration());
    AlphaAnimation alphaAnimation = new AlphaAnimation(1,0);
    alphaAnimation.setDuration(getOptionSD_AnimationDuration());

    animationSet.addAnimation(translateAnimation);
    animationSet.addAnimation(alphaAnimation);
    //设置动画延时
    animationSet.setStartOffset(60*(getOptionPositionCount() - index));
    return animationSet;
}
 
开发者ID:totond,项目名称:YMenuView,代码行数:21,代码来源:TreeYMenu.java

示例5: init

import android.view.animation.AlphaAnimation; //导入依赖的package包/类
private void init(Context context, View target) {
    this.context = context;
    this.target = target;
    fadeIn = new AlphaAnimation(0.0f, 1.0f);
    fadeIn.setInterpolator(new DecelerateInterpolator());
    fadeIn.setDuration(200);
    fadeOut = new AlphaAnimation(1.0f, 0.0f);
    fadeOut.setInterpolator(new AccelerateInterpolator());
    fadeOut.setDuration(200);
    this.isShown = false;
    if (this.target != null) {
        applyTo(this.target);
    } else {
        show();
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:17,代码来源:BottomRedPointView.java

示例6: loadFinishAnimation

import android.view.animation.AlphaAnimation; //导入依赖的package包/类
/**
 * 对话框结束时的动画
 */
@Override
public Animation loadFinishAnimation() {
    TranslateAnimation translateAnimation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0f,
            Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 1f);
    AlphaAnimation alphaAnimation = new AlphaAnimation(1, 0);
    setDefaultConfig(translateAnimation, true);
    setDefaultConfig(alphaAnimation, true);

    translateAnimation.setDuration(DEFAULT_DIALOG_FINISH_ANIM_TIME);
    alphaAnimation.setDuration(DEFAULT_DIALOG_FINISH_ANIM_TIME);

    AnimationSet animationSet = new AnimationSet(false);
    animationSet.addAnimation(alphaAnimation);
    animationSet.addAnimation(translateAnimation);
    return animationSet;
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:20,代码来源:UIIDialogImpl.java

示例7: scaleSmallAnim

import android.view.animation.AlphaAnimation; //导入依赖的package包/类
private Animation scaleSmallAnim(int duration, final View child) {

        AnimationSet animationSet = new AnimationSet(true);

        ScaleAnimation scaleAnim = new ScaleAnimation(1.0f, 0.0f, 1.0f, 0.0f,
                Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
                0.5f);
        AlphaAnimation alphaAnim = new AlphaAnimation(1f, 0.0f);
        alphaAnim.setFillAfter(true);
        animationSet.addAnimation(scaleAnim);
        animationSet.addAnimation(alphaAnim);
        animationSet.setDuration(duration);

        return animationSet;

    }
 
开发者ID:Ethan-9606,项目名称:BottomMenu,代码行数:17,代码来源:BottomMenu.java

示例8: getEndAnimation

import android.view.animation.AlphaAnimation; //导入依赖的package包/类
/**
 * 获得离场动画
 *
 * @return
 */
protected Animation getEndAnimation() {
    AlphaAnimation animAlpha = new AlphaAnimation(1, 0);
    animAlpha.setDuration(TIME_END_ANIM);
    animAlpha.setFillAfter(true);

    TranslateAnimation animTrans = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0f,
            Animation.RELATIVE_TO_PARENT, -1.5f,
            Animation.RELATIVE_TO_PARENT, 0f,
            Animation.RELATIVE_TO_PARENT, 0f);
    animTrans.setDuration(TIME_END_ANIM);
    animTrans.setFillAfter(true);
    animTrans.setInterpolator(new AccelerateInterpolator());

    AnimationSet sets = new AnimationSet(true);
    sets.addAnimation(animAlpha);
    sets.addAnimation(animTrans);

    return sets;
}
 
开发者ID:jeasinlee,项目名称:AndroidBasicLibs,代码行数:25,代码来源:DrawerToast.java

示例9: animateUp

import android.view.animation.AlphaAnimation; //导入依赖的package包/类
/**
 * BottomSheet升起动画
 */
private void animateUp() {
    if (mContentView == null) {
        return;
    }
    TranslateAnimation translate = new TranslateAnimation(
            Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0f,
            Animation.RELATIVE_TO_SELF, 1f, Animation.RELATIVE_TO_SELF, 0f
    );
    AlphaAnimation alpha = new AlphaAnimation(0, 1);
    AnimationSet set = new AnimationSet(true);
    set.addAnimation(translate);
    set.addAnimation(alpha);
    set.setInterpolator(new DecelerateInterpolator());
    set.setDuration(mAnimationDuration);
    set.setFillAfter(true);
    mContentView.startAnimation(set);
}
 
开发者ID:QMUI,项目名称:QMUI_Android,代码行数:21,代码来源:QMUIBottomSheet.java

示例10: startAlphaAnimation

import android.view.animation.AlphaAnimation; //导入依赖的package包/类
public static void startAlphaAnimation(View v, long duration, int visibility) {
    AlphaAnimation alphaAnimation = (visibility == View.VISIBLE)
            ? new AlphaAnimation(0f, 1f)
            : new AlphaAnimation(1f, 0f);

    alphaAnimation.setDuration(duration);
    alphaAnimation.setFillAfter(true);
    v.startAnimation(alphaAnimation);
}
 
开发者ID:appteam-nith,项目名称:Nimbus,代码行数:10,代码来源:CoreTeamEventActivity.java

示例11: setSwipePosition

import android.view.animation.AlphaAnimation; //导入依赖的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

示例12: setHintPanelVisible

import android.view.animation.AlphaAnimation; //导入依赖的package包/类
void setHintPanelVisible(boolean visible)
{
    final int visibility = hintPanel.getVisibility();
    boolean previousVisible = visibility == View.VISIBLE;
    if (previousVisible == visible)
    {
        return;
    }
    if (visible)
    {
        hintPanel.setVisibility(View.VISIBLE);
        final AlphaAnimation alphaAnimation = new AlphaAnimation(0.2f, 1.0f);
        alphaAnimation.setDuration(150);
        hintPanel.setAnimation(alphaAnimation);
        final RotateAnimation rotateAnimation = new RotateAnimation(
                -90, 0, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f);
        rotateAnimation.setDuration(500);
        arrow.startAnimation(rotateAnimation);
    }
    else
    {
        hintPanel.setVisibility(View.GONE);
    }
}
 
开发者ID:WangZhiYao,项目名称:RealmTasks,代码行数:25,代码来源:ItemViewHolder.java

示例13: createPositionAnimation

import android.view.animation.AlphaAnimation; //导入依赖的package包/类
private Animation createPositionAnimation(int fromY, int toY, float fromAlpha, float toAlpha, int duration) {
    TranslateAnimation translate = new TranslateAnimation(0, 0, fromY, toY);
    translate.setDuration(duration);

    AlphaAnimation alpha = new AlphaAnimation(fromAlpha, toAlpha);
    alpha.setDuration(duration);

    AnimationSet set = new AnimationSet(true);
    set.setInterpolator(new DecelerateInterpolator());
    set.addAnimation(translate);
    set.addAnimation(alpha);
    return set;
}
 
开发者ID:Ramotion,项目名称:showroom-android,代码行数:14,代码来源:ItemsCountView.java

示例14: setAlpha

import android.view.animation.AlphaAnimation; //导入依赖的package包/类
/**
 * Add an action to set the alpha of a view. Can be called multiple times.
 * Alpha between 0-1.
 * 设置控件的显示的透明度
 */
public BaseAdapterHelper setAlpha(int viewId, float value) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        retrieveView(viewId).setAlpha(value);
    } else {
        // Pre-honeycomb hack to set Alpha value
        AlphaAnimation alpha = new AlphaAnimation(value, value);
        alpha.setDuration(0);
        alpha.setFillAfter(true);
        retrieveView(viewId).startAnimation(alpha);
    }
    return this;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:BaseAdapterHelper.java

示例15: loadStartAnimation

import android.view.animation.AlphaAnimation; //导入依赖的package包/类
/**
 * 对话框启动时的动画
 */
@Override
public Animation loadStartAnimation() {
    TranslateAnimation translateAnimation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0,
            Animation.RELATIVE_TO_SELF, 1f, Animation.RELATIVE_TO_SELF, 0f);
    AlphaAnimation alphaAnimation = new AlphaAnimation(0, 1);
    setDefaultConfig(translateAnimation, false);
    setDefaultConfig(alphaAnimation, false);

    AnimationSet animationSet = new AnimationSet(false);
    animationSet.addAnimation(alphaAnimation);
    animationSet.addAnimation(translateAnimation);
    return animationSet;
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:17,代码来源:UIIDialogImpl.java


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