Ich habe GridView
und ich möchte animation
wie Google Play Store. Wenn wir auf eine App klicken, wird sie auf ihre Detailseite umgeleitet. Zu dieser Zeit passiert eine kleine Animation. Ich möchte diese Art von Animation für meine GridView
und ihre Detailseite. Ich brauche Hilfe, wenn jemand über diese Art von Aktivität bewusst ist, die von einer Klasse in eine andere Klasse übergeht.Aktivität Animation wie Google Play Store
6
A
Antwort
6
Dies ist Ihre erste Aktivität Code aus, wo Sie Details screenen
bewegen wollen zuimport android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.ActivityOptionsCompat;
import android.support.v4.util.Pair;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
public class StartActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_start);
}
public void onClick(View view) {
View imageView = findViewById(R.id.imageView);
View textView = findViewById(R.id.textView);
View button = findViewById(R.id.button);
Intent intent = new Intent(this, EndActivity.class);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
textView.setTransitionName(getString(R.string.activity_text_trans));
button.setTransitionName(getString(R.string.activity_mixed_trans));
Pair<View, String> pair1 = Pair.create(imageView, imageView.getTransitionName());
Pair<View, String> pair2 = Pair.create(textView, textView.getTransitionName());
Pair<View, String> pair3 = Pair.create(button, button.getTransitionName());
ActivityOptionsCompat options = ActivityOptionsCompat.
makeSceneTransitionAnimation(this, pair1, pair2, pair3);
startActivity(intent, options.toBundle());
}
else {
startActivity(intent);
}
}
}
Dies ist die Details Aktivität screenen
import android.os.Build;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
public class EndActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_end);
View smallImageView = findViewById(R.id.textView);
View editText = findViewById(R.id.editText);
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
smallImageView.setTransitionName(getString(R.string.activity_text_trans));
editText.setTransitionName(getString(R.string.activity_mixed_trans));
}
}
}
FirstActivity layouut Datei
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="16dp">
<ImageView
android:id="@+id/imageView"
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_centerHorizontal="true"
android:src="@drawable/aa_logo_green"
android:transitionName="@string/activity_image_trans"/>
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/imageView"
android:text="Simple TextView"
android:textSize="20sp"/>
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/textView"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:text="Click Me"
style="@style/Widget.AppCompat.Button.Borderless"
android:onClick="onClick"/>
</RelativeLayout>
EndActivity xml-Layout-Datei
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="16dp">
<ImageView
android:id="@+id/imageView"
android:layout_width="220dp"
android:layout_height="220dp"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:src="@drawable/aa_logo_green"
android:transitionName="@string/activity_image_trans"/>
<EditText
android:id="@+id/editText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:hint="An EditText"
android:textSize="24sp"/>
<ImageView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toLeftOf="@id/imageView"
android:layout_alignBottom="@id/imageView"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:src="@drawable/aa_logo_blue"/>
</RelativeLayout>
1
Ich glaube, Sie wollen genau das Material Aktivität Transaktion, lesen Sie diese developer doc here auch diese lib für Translation Animation versuchenhttps://github.com/lgvalle/Material-Animations
Verwandte Themen
- 1. Google Play Store Autosuggest?
- 2. Google Play Store Fehlercode -2
- 3. Collapsing Toolbar Wie Google Play Store
- 4. Programmgesteuert herunterladen APK von Google Play Store
- 5. Google Play/App Store In-App-Kaufrichtlinien
- 6. Bereitstellung im Google Play Store über API
- 7. Google Play Store APK - Gerätekompatibilität Ausgabe
- 8. Zurücksetzen der Versionsnummer im Google Play Store
- 9. Apk Download zählen Google Play Store?
- 10. Google Karte nicht im Play Store apk
- 11. 0 Geräte unterstützt Google Play Store
- 12. Benutzer zu iTunes App Store oder Google Play Store umleiten?
- 13. Android Play Store-Benachrichtigungsbericht
- 14. Get Play Store Ansichten und installiert wie "Google Play Referral Flow" mit Google Analytics Berichterstattung api
- 15. Google Play Games - Aktivität automatisch aufrufen beginUserInitiatedSignIn()
- 16. Google play store wie Schnittstelle mit recycler view
- 17. Wie man Benutzer automatisch aktualisieren Anwendung mit Google Play Store
- 18. Wie Tango Projekt apk in Google Play Store Push
- 19. Wie Play Store in genymotion
- 20. Wie kann ich im Play Store veröffentlichen?
- 21. Android Instant Apps Play Store
- 22. Link zum Play Store App
- 23. Listview ähnlich wie bei Google Play-Einstellungen Aktivität in Android
- 24. Wenn der Google Play Store ausgeblendet ist, ist der Google Play-Dienst nicht verfügbar.
- 25. VS Emulator für Android: Google Play Store Abstürze nach neuer Installation von Gapps (Google Play Services)
- 26. Alternativer Eintrag im Play Store
- 27. Fehlermeldung zeigt, während Apk zu dem Google Play Store hochzuladen
- 28. Veröffentlichen mobile Website im App Store und Google Play
- 29. Kann ich nur Vorlagendateien im Google Play Store hochladen?
- 30. So öffnen Sie Google Play Store App direkt ohne Auswahlabsicht
Dies ist kein "lib" . Es ist eine Erklärung, wie man googles [Android Transition Framework] (https://developer.android.com/training/transitions/overview.html) verwendet. Und es ist großartig! –