Add animation at run time Add animation at run time xml xml

Add animation at run time


Constructor that you used creates animation with absolute values (pixels).

TranslateAnimation in = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 1.0f,Animation.RELATIVE_TO_SELF, 0.0f, 0, 0.0f, 0, 0.0f);

Try use Animation.RELATIVE_TO_PARENT to fit your needs.