我该如何调整imageButton的大小?

eng*_*med 8 android resize imagebutton

我想调整我ImageButton使用鼠标的图形布局或使用代码的 android:layout_width,android:layout_height.但是每当我这样做时,它ImageButton都没有调整大小,实际上它并不小,但它在边缘被切割.

提前致谢

rid*_*doy 15

首先尝试使用android:background而不是android:src来设置按钮上的图像.在大多数情况下,它会有所帮助.如果没有,那么请看这些..


ces*_*nec 5

从 steven-byle 的解决方案(/sf/answers/1058227551/)中,他说:

“...使用 android:scaleType="fitCenter" 让 Android 缩放图像,并使用 android:adjustViewBounds="true" 让它们因缩放而调整其边界..."

这个对我有用