本文整理匯總了Java中android.view.animation.AlphaAnimation.setAnimationListener方法的典型用法代碼示例。如果您正苦於以下問題:Java AlphaAnimation.setAnimationListener方法的具體用法?Java AlphaAnimation.setAnimationListener怎麽用?Java AlphaAnimation.setAnimationListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.view.animation.AlphaAnimation
的用法示例。
在下文中一共展示了AlphaAnimation.setAnimationListener方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setImgBackGround
import android.view.animation.AlphaAnimation; //導入方法依賴的package包/類
private void setImgBackGround() {
String[] images = getResources().getStringArray(R.array.splash_background);
int position = new Random().nextInt(images.length - 1) % (images.length);
Glide.with(this)
.load(images[position])
.into(mImgBackGround);
String path = SpUtil.getString(this, "path");
Glide.with(this)
.load(path)
.asBitmap()
.error(R.drawable.def_avatar)
.into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
mCircleImageView.setImageBitmap(resource);
}
});
//設置圖像的透明度
AlphaAnimation animation = new AlphaAnimation(0.1f, 1.0f);
animation.setDuration(800);
mCircleImageView.startAnimation(animation);
animation.setAnimationListener(this);
}
示例2: fadeIn
import android.view.animation.AlphaAnimation; //導入方法依賴的package包/類
/**
* <p>對 View 做透明度變化的進場動畫。</p>
* <p>相關方法 {@link #fadeOut(View, int, Animation.AnimationListener, boolean)}</p>
*
* @param view 做動畫的 View
* @param duration 動畫時長(毫秒)
* @param listener 動畫回調
* @param isNeedAnimation 是否需要動畫
*/
public static AlphaAnimation fadeIn(View view, int duration, Animation.AnimationListener listener, boolean isNeedAnimation) {
if (view == null) {
return null;
}
if (isNeedAnimation) {
view.setVisibility(View.VISIBLE);
AlphaAnimation alpha = new AlphaAnimation(0, 1);
alpha.setInterpolator(new DecelerateInterpolator());
alpha.setDuration(duration);
alpha.setFillAfter(true);
if (listener != null) {
alpha.setAnimationListener(listener);
}
view.startAnimation(alpha);
return alpha;
} else {
view.setAlpha(1);
view.setVisibility(View.VISIBLE);
return null;
}
}
示例3: animate
import android.view.animation.AlphaAnimation; //導入方法依賴的package包/類
private static void animate(View view, int duration, AnimationListener listener, float fromAlpha, float targetAlpha) {
// Create new animation
AlphaAnimation newAnimation = new AlphaAnimation(fromAlpha, targetAlpha);
newAnimation.setDuration(duration);
// Force fillAfter flag to be true
newAnimation.setFillAfter(true);
newAnimation.setAnimationListener(listener);
// Start fading
view.startAnimation(newAnimation);
}
示例4: getAlphaAnimation
import android.view.animation.AlphaAnimation; //導入方法依賴的package包/類
/**
* Gets a transparency gradient animation
*
* @param fromAlpha Transparency at the beginning
* @param toAlpha Transparency at the end
* @param durationMillis duration
* @param animationListener Animation monitor
* @return A transparency gradient animation
*/
public static AlphaAnimation getAlphaAnimation(float fromAlpha, float toAlpha, long durationMillis, Animation.AnimationListener animationListener) {
AlphaAnimation alphaAnimation = new AlphaAnimation(fromAlpha, toAlpha);
alphaAnimation.setDuration(durationMillis);
if (animationListener != null)
alphaAnimation.setAnimationListener(animationListener);
return alphaAnimation;
}
示例5: getAlphaAnimation
import android.view.animation.AlphaAnimation; //導入方法依賴的package包/類
/**
* 獲取一個透明度漸變動畫
*
* @param fromAlpha 開始時的透明度
* @param toAlpha 結束時的透明度都
* @param durationMillis 持續時間
* @param animationListener 動畫監聽器
* @return 一個透明度漸變動畫
*/
public static AlphaAnimation getAlphaAnimation(float fromAlpha, float toAlpha, long durationMillis, AnimationListener animationListener) {
AlphaAnimation alphaAnimation = new AlphaAnimation(fromAlpha, toAlpha);
alphaAnimation.setDuration(durationMillis);
if (animationListener != null) {
alphaAnimation.setAnimationListener(animationListener);
}
return alphaAnimation;
}