2017-08-02 1 views
0

enter image description here Ich möchte ein Layout, in dem Animation wie Bild unten zu entwerfen. Es ist nicht gerade von unten links zu Mitte sollte sein kreisförmige Weg. Fünf Bilder sollten von links unten kommen einzeln. ich den Code bereits getan, aber es ist eigentlich nicht funktioniert, was ich will, ich will nur wissen, um das, was ich in dem Anim Ordner (Animation Ressourcendatei)Android Animation: Übersetzen Sie unten links in die Mitte des Bildschirms

[![<?xml version="1.0" encoding="utf-8"?> 

<set xmlns:android="http://schemas.android.com/apk/res/android" 
    android:shareInterpolator="false"> 
    <translate 
     android:duration="1500" 
     android:fromXDelta="0%" 
     android:fromYDelta="200%" 
     android:toXDelta="0%" 
     android:toYDelta="0%" /> 
</set>][1]][1] 

Antwort

0

Obige Antwort ist nützlich für diese Frage, aber Sie müssen fünf Anim wie Sie erwähnt haben.

Animation anim = AnimationUtils.loadAnimation(getApplicationContext(),R.anim.first_anim); 
     yourView.setAnimation(anim); 

Animation anim2 = AnimationUtils.loadAnimation(getApplicationContext(),R.anim.two_anim); 
    yourView.setAnimation(anim2); 

Animation anim3 = AnimationUtils.loadAnimation(getApplicationContext(),R.anim.three_anim); 
    yourView.setAnimation(anim3); 

Animation anim4 = AnimationUtils.loadAnimation(getApplicationContext(),R.anim.four_anim); 
    yourView.setAnimation(anim4); 

Animation anim5 = AnimationUtils.loadAnimation(getApplicationContext(),R.anim.five_anim); 
    yourView.setAnimation(anim5); 
0

Dafür wir schaffen fünf anim haben setzen styles und müssen alle diese fünf Kreise nacheinander setzen.

first_anim.xml

<?xml version="1.0" encoding="utf-8"?> 
<set xmlns:android="http://schemas.android.com/apk/res/android" 
    android:shareInterpolator="false"> 
    <translate 
     android:duration="1000" 
     android:fromXDelta="-300%" 
     android:fromYDelta="1100%" 
     android:toXDelta="0%" 
     android:toYDelta="0%" /> 
</set> 

second_anim.xml

<?xml version="1.0" encoding="utf-8"?> 

<set xmlns:android="http://schemas.android.com/apk/res/android" 
android:shareInterpolator="false"> 
<translate 
    android:duration="1200" 
    android:fromXDelta="-350%" 
    android:fromYDelta="800%" 
    android:toXDelta="0%" 
    android:toYDelta="0%" /> 

third_anim.xml

<?xml version="1.0" encoding="utf-8"?> 

<set xmlns:android="http://schemas.android.com/apk/res/android" 
android:shareInterpolator="false"> 
<translate 
    android:duration="1500" 
    android:fromXDelta="-380%" 
    android:fromYDelta="800%" 
    android:toXDelta="0%" 
    android:toYDelta="0%" /> 

four_anim.xml

<?xml version="1.0" encoding="utf-8"?> 

<set xmlns:android="http://schemas.android.com/apk/res/android" 
android:shareInterpolator="false"> 
<translate 
    android:duration="1800" 
    android:fromXDelta="-500%" 
    android:fromYDelta="800%" 
    android:toXDelta="0%" 
    android:toYDelta="0%" /> 

five_anim.xml

<?xml version="1.0" encoding="utf-8"?> 

<set xmlns:android="http://schemas.android.com/apk/res/android" 
android:shareInterpolator="false"> 
<translate 
    android:duration="2000" 
    android:fromXDelta="-600%" 
    android:fromYDelta="800%" 
    android:toXDelta="0%" 
    android:toYDelta="0%" /> 

Und jetzt Ihre Ansicht Animation-Klasse gesetzt.

Verwandte Themen