I want the drawable inside my ImageView to be shown aligned to the bottom 开发者_JAVA百科(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>
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
If you have SVG you can open it in https://boxy-svg.com/app or any other online svg editor
Align Image Bottom.
精彩评论