flavioarfaria / KenBurnsView

Android ImageViews animated by Ken Burns Effect
Apache License 2.0
2.73k stars 435 forks source link

not correctly displaying scaleType #40

Closed wwwdotphilip closed 8 years ago

wwwdotphilip commented 8 years ago

When I try to display an image with a scaleType="fitCenter" it doesn't do what it actually does like a normal ImageView.

Here is my code.

<com.flaviofaria.kenburnsview.KenBurnsView
    android:id="@+id/image"
    android:layout_width="match_parent"
    android:layout_height="200dp"
    android:src="@drawable/ic_launcher"
    android:scaleType="fitCenter" />

<Button
    android:id="@+id/button"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:onClick="cyclePhoto"
    android:text="Cycle photo" />

The output show's like this.

screenshot

instead of this

screenshot
flavioarfaria commented 8 years ago

Hi,

This is already expected and works like this by design. KenBurnsView ignores the imageType attribute and forces all images to center_crop to limit the viewport to the image bounds. That's how the Ken Burns Effect works: https://en.wikipedia.org/wiki/Ken_Burns_effect. If you need your image to be fit-centered, KenBurnsView is not really what you're looking for.