1
Good Afternoon!
I have a Linearlayout that will be displayed when the user selects a Switch
For this I created two methods, for fadein and fadeOut. Follow:
private LayoutAnimationController fadeIn(){
Animation fadeIn = AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in);
AnimationSet set=new AnimationSet(true);
fadeIn.setDuration(155);
set.addAnimation(fadeIn);
set.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
mLayout.setVisibility(View.VISIBLE);
}
@Override
public void onAnimationEnd(Animation animation) {}
@Override
public void onAnimationRepeat(Animation animation) {}
});
return new LayoutAnimationController(set);
}
private LayoutAnimationController fadeOut(){
AnimationSet set=new AnimationSet(true);
Animation fadeOut = AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_out);
fadeOut.setDuration(255);
set.addAnimation(fadeOut);
set.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) { }
@Override
public void onAnimationEnd(Animation animation) {
mLayout.setVisibility(View.GONE);
}
@Override
public void onAnimationRepeat(Animation animation) {}
});
return new LayoutAnimationController(set);
}
The problem occurs in the fadein , when trying to execute the onAnimationStart(Animation animation) mLayout.setVisibility(View.VISIBLE); }
The Layout is not displayed!
Someone would know the right way to do it?
From now on agardeço, Greetings!