4

Ich habe Skala Animation zum Zoomen eines Bildes in meiner App verwenden. Es funktioniert gut Zoombild Ebene richtig, die wir wollen, aber mein Problem ist, wenn das Bild nicht zoomen glatter. Bildgröße ist 1,4 MB.Skala Animation nicht glatt in android auf Bildansicht

ScaleAnimation scaleAnimation = new ScaleAnimation(1f, 2.5f, 
         1f, 2.5f, Animation.RELATIVE_TO_PARENT, 
         1.05f, Animation.RELATIVE_TO_PARENT, 1.05f); 
    scaleAnimation.setFillAfter(true); 
    scaleAnimation.setDuration(400); 
    img.startAnimation(scaleAnimation); 
+0

check out mein approch und versuche es. – Ironman

+0

ok ich versuche es .. nach einiger Zeit @Ironman –

Antwort

1

Android Animationen mit Zoom animation smoothlyHere.

können Sie sie speziell für glatter zu machen.

2

Wenn Ihr min sdk Version größer ist als 13, dann können Sie versuchen,

img.animate().scaleX(2.5f).scaleY(2.5f).setDuration(400).start(); 
0

erstellen scale_up.xml:

<set xmlns:android="http://schemas.android.com/apk/res/android"> 
    <scale android:fromXScale="1" 
      android:fromYScale="1" 
      android:toXScale="1.2" 
      android:toYScale="1.2" 
      android:pivotX="50%" 
      android:pivotY="50%" 
      android:duration="400"/> 
</set> 

und Verwenden Sie diese Art und Weise ..

Animation animation = AnimationUtils.loadAnimation(this, R.anim.scale_up); 
((ImageView) findViewById(R.id.circle_image)).startAnimation(animation); 

Es wird Ihnen glatte Animation geben.

Hinweis: sicher, dass glatte Animation Sie android:pivotX und android:pivoty auf die Hälfte des Bildschirms einstellen müssen, um zu bekommen.

Verwandte Themen