use of android.view.animation.AlphaAnimation in project openkit-android by OpenKit.
the class PickerFragment method setAlpha.
private static void setAlpha(View view, float alpha) {
// Set the alpha appropriately (setAlpha is API >= 11, this technique works on all API levels).
AlphaAnimation alphaAnimation = new AlphaAnimation(alpha, alpha);
alphaAnimation.setDuration(0);
alphaAnimation.setFillAfter(true);
view.startAnimation(alphaAnimation);
}
use of android.view.animation.AlphaAnimation in project FastDev4Android by jiangqqlmj.
the class BaseAdapterHelper method setAlpha.
/**
* 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;
}
use of android.view.animation.AlphaAnimation in project KJFrameForAndroid by kymjs.
the class KJAnimations method getAlphaAnimation.
/**
* 透明度 Alpha
*/
public static Animation getAlphaAnimation(float fromAlpha, float toAlpha, long durationMillis) {
AlphaAnimation alpha = new AlphaAnimation(fromAlpha, toAlpha);
alpha.setDuration(durationMillis);
alpha.setFillAfter(true);
return alpha;
}
use of android.view.animation.AlphaAnimation in project Lazy by l123456789jy.
the class ViewAnimationUtils method invisibleViewByAlpha.
// /**
// * 默认动画持续时间
// */
// public static final long DEFAULT_ANIMATION_DURATION = 300;
/*
* ************************************************************* 视图透明度渐变动画
* ********************************************************************
*/
/**
* 将给定视图渐渐隐去(view.setVisibility(View.INVISIBLE))
*
* @param view 被处理的视图
* @param isBanClick 在执行动画的过程中是否禁止点击
* @param durationMillis 持续时间,毫秒
* @param animationListener 动画监听器
*/
public static void invisibleViewByAlpha(final View view, long durationMillis, final boolean isBanClick, final AnimationListener animationListener) {
if (view.getVisibility() != View.INVISIBLE) {
view.setVisibility(View.INVISIBLE);
AlphaAnimation hiddenAlphaAnimation = AnimationUtils.getHiddenAlphaAnimation(durationMillis);
hiddenAlphaAnimation.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
if (isBanClick) {
view.setClickable(false);
}
if (animationListener != null) {
animationListener.onAnimationStart(animation);
}
}
@Override
public void onAnimationRepeat(Animation animation) {
if (animationListener != null) {
animationListener.onAnimationRepeat(animation);
}
}
@Override
public void onAnimationEnd(Animation animation) {
if (isBanClick) {
view.setClickable(true);
}
if (animationListener != null) {
animationListener.onAnimationEnd(animation);
}
}
});
view.startAnimation(hiddenAlphaAnimation);
}
}
use of android.view.animation.AlphaAnimation in project Lazy by l123456789jy.
the class ViewAnimationUtils method visibleViewByAlpha.
/**
* 将给定视图渐渐显示出来(view.setVisibility(View.VISIBLE))
*
* @param view 被处理的视图
* @param durationMillis 持续时间,毫秒
* @param isBanClick 在执行动画的过程中是否禁止点击
* @param animationListener 动画监听器
*/
public static void visibleViewByAlpha(final View view, long durationMillis, final boolean isBanClick, final AnimationListener animationListener) {
if (view.getVisibility() != View.VISIBLE) {
view.setVisibility(View.VISIBLE);
AlphaAnimation showAlphaAnimation = AnimationUtils.getShowAlphaAnimation(durationMillis);
showAlphaAnimation.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
if (isBanClick) {
view.setClickable(false);
}
if (animationListener != null) {
animationListener.onAnimationStart(animation);
}
}
@Override
public void onAnimationRepeat(Animation animation) {
if (animationListener != null) {
animationListener.onAnimationRepeat(animation);
}
}
@Override
public void onAnimationEnd(Animation animation) {
if (isBanClick) {
view.setClickable(true);
}
if (animationListener != null) {
animationListener.onAnimationEnd(animation);
}
}
});
view.startAnimation(showAlphaAnimation);
}
}
Aggregations