Android : Expand Animation to work on both sides (on negative axis)

on Friday, January 30, 2015


I implemented an ExpandAnimation on view like this:



@Override
protected void applyTransformation(float interpolatedTime,
Transformation t) {
LayoutParams lp =
(LayoutParams) view.getLayoutParams();
if(rightAnimation){
lp.width = (int) (mStartWidth + mDeltaWidth *
interpolatedTime);
view.setLayoutParams(lp);
}else{

}

}


With this animation my view expands and shrinks.


What i want to do is to implement this animation to the other side as well. But i get confused a little bit, since shrinking the width will not work. (Since minus widths or heights are not allowed)


Does anyone know a better way to implement expand animation to the left or up side as well?


0 comments:

Post a Comment