2016-06-30 19 views
1

Ich habe ein ImageView in meinem Android-Projekt. Und ich muss diese Bildansicht in einigen Fällen drehen. Alle Rotationen werden mit Hilfe der Rotationsanimation durchgeführt. Wenn ein ImageView jedoch um 90 oder 270 Grad gedreht wird, wird das darin enthaltene Bitmap oben und unten abgeschnitten. Und ich habe keine Ahnung, warum das passiert. Kann mir jemand einen Rat geben, wie man solches Verhalten vermeidet?Bitmap in ImageView wird nach der Drehung abgeschnitten

  final ImageView photoView = (ImageView) main_activity.findViewById(R.id.photo_view); 
      RotateAnimation mRotateAnim = new RotateAnimation(oldRotation, newRotation, photoView.getPivotX(), photoView.getPivotY()); 
      mRotateAnim.setDuration(500); 
      mRotateAnim.setFillAfter(true); 
      photoView.startAnimation(mRotateAnim); 

Und das ist meine Image Erklärung innerhalb XML-Datei:

<ImageView 
      android:id="@+id/photo_view" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_centerInParent="true" 
      android:layout_above="@+id/bottom_container" 
      android:adjustViewBounds="true"/> 
+0

Sie eine Lösung gefunden? – Juvi

Antwort

1

Versuchen

RotateAnimation mRotateAnim = new RotateAnimation(oldRotation, newRotation, photoView.getPivotX(), photoView.getPivotY()); 

mit wechselnden:

RotateAnimation mRotateAnim = new RotateAnimation(oldRotation, newRotation, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); 
+0

Danke für den Rat, aber diese Lösung hat mir nicht geholfen ((( –