0

here is my situation, I have an imageview like that:

https://i.stack.imgur.com/6EyFr.png

Can you see my "+" sign is not at the end of my "no profile picture" image, that's because this image is not filling its imageView.

I have tried android:adjustViewBounds="true" and android:scaleType="fitXY" like was said in Unwanted padding around an ImageView, but it didn't work for me.

Any idea?

EDIT:

I forgot my layout:

<RelativeLayout
    android:gravity="center"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <ImageView
        android:layout_marginTop="10dp"
        android:id="@+id/iv_profile_picture"
        android:layout_width="140dp"
        android:layout_height="140dp"
        android:adjustViewBounds="true"
        android:src="@mipmap/ic_no_image_profile"
        />

    <ImageButton
        android:src="@mipmap/ic_new_image_profile"
        android:background=""
        android:layout_width="30dp"
        android:layout_height="30dp"
        android:layout_alignRight="@+id/iv_profile_picture"
        android:layout_alignEnd="@+id/iv_profile_picture"
        android:layout_alignBottom="@+id/iv_profile_picture"/>

</RelativeLayout>

Community
  • 1
  • 1
guisantogui
  • 4,017
  • 9
  • 49
  • 93

1 Answers1

0

You can do this way:

Remove android:layout_marginTop="10dp" from your xml.

Your xml code should looks like below:

<ImageView
        android:id="@+id/iv_profile_picture"
        android:layout_width="140dp"
        android:layout_height="140dp"
        android:scaleType="fitXY"
        android:adjustViewBounds="true"
        android:src="@mipmap/ic_no_image_profile"
        />

Hope this will help you.

Hiren Patel
  • 52,124
  • 21
  • 173
  • 151