2017-03-07 5 views
0

Demo PictureSchalter

Gibt es trotzdem das zweite Layout zum ersten Layout zu wechseln, indem Effekte Schiebe?

Ich möchte Button onclick dann schieben Sie das Layout. Ich habe viele Möglichkeiten ausprobiert, komme aber nicht ans Ziel.

Antwort

0
Animation anim1 = AnimationUtils.loadAnimation(getApplicationContext(),R.anim.slide_from_left); 
      anim1.setDuration(1000); // set how long you want the animation 

Animation anim2 = AnimationUtils.loadAnimation(getApplicationContext(),R.anim.slide_to_right); 
      anim2.setDuration(1000); // set how long you want the animation 

firstlayout.setAnimation(anim1); 
secondlayout.setAnimation(anim2); 
secondlayout.setVisibility(View.Invisible); 

schaffe ich das Ergebnis mit über Codes zu erhalten. Vielen Dank.

0

überprüfen Sie dies: https://github.com/lgvalle/Material-Animations. Es enthält tolle Beispiele für Materialübergänge und Animationen.

+0

Vielen Dank für Ihre Antwort. Gibt es eine Lösung ohne die Verwendung von Dritten? –

+1

https://developer.android.com/training/material/animations.html – Remario

0

verwenden Sie dies.

this.overridePendingTransition(R.anim.animation_enter, 
       R.anim.animation_leave) 

//

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

+0

Wenn ich nur für den Übergang im Layout gehen möchte? Denn scheinbar wird diese Lösung verwendet, um die Animation beim Start einer neuen Intent zu machen. –

+0

können Sie Animation für diesen Zweck verwenden, verwenden Sie diesen Link http://www.androidhive.info/2013/06/android-working-with-xml-animations/ –

+0

sein großes Konzept –