Quick tips to set ImageView width and height fit layout?
Footnote for anyone struggling with this coming from another platform. the "size and shape to fit" option is handled beautifully in Android; but it's hard to find. you typically want width match parent, height wrap content, adjustViewBounds turned on, scale fitToCenter and cropToPadding false. then it's automatic. I really hope it helps someone!
Example :
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="fitCenter"
android:id="@+id/thumbnail_book"
android:src="@drawable/samplebook"
android:cropToPadding="false"
android:adjustViewBounds="true" />
from : http://stackoverflow.com/q/3144940
Example :
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="fitCenter"
android:id="@+id/thumbnail_book"
android:src="@drawable/samplebook"
android:cropToPadding="false"
android:adjustViewBounds="true" />
from : http://stackoverflow.com/q/3144940
No comments: