Align Image Within Imageview To Bottom Center
I have a simple imageView and I want an image to be displayed in the center of the bottom. At the moment it is displayed in the bottom right corner.
Solution 1:
<RelativeLayoutxmlns:android="http://schemas.android.com/apk/res/android"xmlns:app="http://schemas.android.com/apk/res-auto"android:layout_width="match_parent"android:layout_height="match_parent"><LinearLayoutandroid:layout_width="300dp"android:layout_height="300dp"android:gravity="bottom|center"><ImageViewandroid:id="@+id/picture"android:layout_width="wrap_content"android:layout_height="wrap_content"android:scaleType="centerInside"app:srcCompat="@drawable/ic_chat" /></LinearLayout>
Add another view as parent
Solution 2:
You can take RelativeLayout as a parent layout and set in ImageView
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
try this ...
Solution 3:
Look at answer for similar question. I think, using android:scaleType="matrix"
can resolve problem.
Solution 4:
If parent is linear layout then try :
android:layout_gravity="center"
If parent is relative layout then use :
android:layout_centerHorizontal="true"
Post a Comment for "Align Image Within Imageview To Bottom Center"