I have 6 ImageButton in my activity, I set images through my code in them ( not using xml).
I want them to cover 75% of the button area. But where as some images cov
I'm using the following code in xml
android:adjustViewBounds="true"
android:scaleType="centerInside"
It worked well in my case. First, you download an image and rename it as iconimage, locates it in the drawable folder. You can change the size by setting android:layout_width
or android:layout_height
. Finally, we have
<ImageButton
android:id="@+id/answercall"
android:layout_width="120dp"
android:layout_height="80dp"
android:src="@drawable/iconimage"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:scaleType="fitCenter" />