Android - & gt; comment animer à la nouvelle position

Ici est simple xml android animation:

<translate xmlns:android="http://schemas.android.com/apk/res/android"
    android:fromXDelta="0" android:fromYDelta="0" android:toXDelta="-110"
    android:toYDelta="-110" android:duration="1000" android:fillAfter="true" />

Je veux déplacer un objet animé à partir du centre de l'écran pour 0, 0 positions. Comment le chat je le fais (il devrait fonctionner sur toutes les résolutions d'écran)


Ma Réponse:

Merci les gars pour votre aide. Mais j'ai régler mon problème par l'autre manière, de façon dynamique, sans xml. Voici le code complet de cette méthode:

public void replace(int xTo, int yTo, float xScale, float yScale) {
        //create set of animations
        replaceAnimation = new AnimationSet(false);
        //animations should be applied on the finish line
        replaceAnimation.setFillAfter(true);

        //create scale animation
        ScaleAnimation scale = new ScaleAnimation(1.0f, xScale, 1.0f, yScale);
        scale.setDuration(1000);

        //create translation animation
        TranslateAnimation trans = new TranslateAnimation(0, 0,
                TranslateAnimation.ABSOLUTE, xTo - getLeft(), 0, 0,
                TranslateAnimation.ABSOLUTE, yTo - getTop());
        trans.setDuration(1000);

        //add new animations to the set
        replaceAnimation.addAnimation(scale);
        replaceAnimation.addAnimation(trans);

        //start our animation
        startAnimation(replaceAnimation);
    }

source d'informationauteur pleerock