當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。