Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change icon size in button android

Tags:

android

I have a button which have both text and image. The image size it is taking as actual size of image. How can i change the size of image in button?

<Button
    android:id="@+id/button3"
    android:layout_weight="1"
    android:layout_height="match_parent"
    android:layout_width="wrap_content"
    android:drawableTop="@drawable/home_icon"
    android:text="Settings"
    />
like image 882
Devesh Agrawal Avatar asked Jan 08 '23 00:01

Devesh Agrawal


1 Answers

Set

android:scaleType="fitXY"

Also wrap_content is the preferred Parameter for width and height so that the OS will automatically adjust depending upon the screen size. Please refer to Android - Image Button Scale and Adjusting the size of an ImageButton in Android

like image 146
RajeshDA Avatar answered Jan 28 '23 05:01

RajeshDA