Skip to content Skip to sidebar Skip to footer

Android: Problems With Adjusting View Size In An Imagebutton

I'm trying something that should be simple, an imageButton and some text that says something about it. My problem is, the view of the imageButton is bigger than the image itself. I

Solution 1:

The problem is using scaleX and scaleY to adjust the size. The button changes it's visible size, but the rest of the layout acts as if it were the original full scale.

I'd suggest using a different method of defining the size, for example:

    <ImageButton
        android:id="@+id/imageButton"
        android:layout_width="48dp"
        android:layout_height="48dp"
        android:background="@android:color/transparent"
        android:scaleType="fitXY"
        android:src="@drawable/icon1"
        android:padding="0dp"/>

Post a Comment for "Android: Problems With Adjusting View Size In An Imagebutton"