I want the drawable inside my ImageView to be shown aligned to the bottom (of the Imageview), and not centered.
Is it possible to do that?
I want the drawable inside my ImageView to be shown aligned to the bottom (of the Imageview), and not centered.
Is it possible to do that?
Maybe this is too late, but even I ran into the same problem today and fixed it by using the following snippet.
All the alignment/scaling options are in the scaleType attribute.
Now, if you want to align the image with the beginning of the ImageView, use android:scaleType="fitStart"
.
Similarly, android:scaleType="fitEnd"
to align it with the bottom of the ImageView.
You can wrap the ImageView
inside a FrameLayout
and align using android:layout_gravity
like this:
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|bottom"
android:src="@drawable/img_select_profile" />
</FrameLayout>
If you have SVG you can open it in https://boxy-svg.com/app or any other online svg editor
Align Image Bottom.
You'll have to set the weight of it to 1 or set its alignment to bottom.
http://developer.android.com/reference/android/widget/LinearLayout.LayoutParams.html
© 2022 - 2024 — McMap. All rights reserved.
fitStart
put image in top-left corner andfitEnd
put in bottom-right corner. But what if you want image atbottom-center
? For that Fresco provides custom scalType. – Stome