G. Hernandez
G. Hernandez

Reputation: 11

Remove Padding ImageButton

this is my button

I’m using ImageButton and I can’t remove a padding or space between my image and the border of the button. How can I achieve this?

this is my layout

<ImageButton
 android:id="@+id/imageButton"
 style="?attr/selectableItemBackgroundBorderless"
 android:layout_width="103dp"
 android:layout_height="110dp"
 android:layout_marginLeft="8dp"
 android:layout_weight="1"
 android:paddingBottom="-15dp"
 android:paddingTop="30dp"
 android:scaleType="fitCenter"
 app:srcCompat="@drawable/com_facebook_profile_picture_blank_square" />

Thanks a lot!

Upvotes: 0

Views: 1319

Answers (2)

G. Hernandez
G. Hernandez

Reputation: 11

Thank you very much! this was my solution:

<ImageButton
android:id="@+id/imageButton"
style="?attr/selectableItemBackgroundBorderless"
android:layout_width="103dp"
android:layout_height="110dp"
android:layout_marginLeft="8dp"
android:paddingBottom="0dp"
android:paddingTop="50dp"
android:scaleType="fitCenter"
app:srcCompat="@mipmap/ic_launcher"
 />

I set padding bottom to 0

Upvotes: 1

Kishan Boghra
Kishan Boghra

Reputation: 101

try this! may work for you

android:scaleType="centercrop"

Upvotes: 0

Related Questions