Resize ImageButton?

From steven-byle's solution (https://stackoverflow.com/a/15117536/1741997), he says:

"...Use an android:scaleType="fitCenter" to have Android scale the images, and android:adjustViewBounds="true" to have them adjust their bounds due to scaling..."

It works for me


try setting android:background instead of android:src for setting the image on the button. That might help in your case, since it will stretch the image to your button's size. Also, you will have to specify fixed dimensions for the buttons (use dip instead of px). Example:

<ImageButton
     android:background="@drawable/ic_menu_more"
     android:layout_width="50dip"
     android:layout_height="50dip" />

First try to use android:background instead of android:src for setting the image on the button.In most cases,it helps.If not,then see these..

  • ImageButton in Android
  • Resize ImageButton?

Tags:

Android