Reputation: 459
I have an ImageView that scales down when I set the layout width to fill parent. But when I change it to an ImageButton, it doesn't scale. How do I get the ImageButton to look like the ImageView?
Upvotes: 3
Views: 390
Reputation: 4205
As Jave suggested, set scaleType
to centerCrop
. And also set padding
to 0dp
to take out button borders.
Upvotes: 0
Reputation: 31846
Use the android:scaleType attribute (set to center inside or something like that).
However, even if you can get it to scale, I am not sure if you'll get the result you want. The imagebutton displays a regular button, but with an image instead of text, that is you'll get the button-borders around your image. If the imageview works as you want it to, why don't you keep it as an imageview, but set the focusable and clickable attributes on it?
Upvotes: 1