Ответ 1
Используйте android:adjustViewBounds=true
attr в xml для ImageView
Этот вопрос решается здесь, расширяя класс ImageView.
Android ImageView, регулирующий высоту и ширину установки родителя
Я создал образец. Меня устраивает. Вот файл макета xml.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView android:src="@drawable/hydrangeas"
android:layout_height="wrap_content" android:id="@+id/imageView1"
android:scaleType="centerInside"
android:adjustViewBounds="true"
android:background="@android:color/white"
android:layout_width="wrap_content"/>
</LinearLayout>
Он работает и для fitCenter
. Посмотрите на снимок.