Image could be bigger dimension than the device. I want to scale the image so that it always take full width and variable length of height , while maintaining aspect ratio.
Also I want to set specific min height of Imageview
when it is scrolled. after that specified min height ImageView
should be pinned.
<android.support.design.widget.AppBarLayout
android:id="@+id/foo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/grey_dark_transparent">
<!--
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/grey_dark_transparent"
app:layout_collapseMode="parallax"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
-->
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<ImageView
android:id="@+id/wallpaper_banner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="fitXY"
android:adjustViewBounds="true"
android:src="@drawable/wallpaper_placeholder" />
</android.support.design.widget.CollapsingToolbarLayout>
<!-- @Banner -->
</android.support.design.widget.AppBarLayout>
Currently it does not maintaining aspect ratio.