How can I stretch the image in imagebutton to the whole area of the imagebutton?

前端 未结 7 980
感情败类
感情败类 2021-02-01 18:09

Here is a picture that will help you understand my problem:

\"It's

I want to stretch

7条回答
  •  不要未来只要你来
    2021-02-01 19:00

    You should consider creating a 9-patch image to make the image fit correctly on an ImageButton in case you need to stretch it, but you don't want the image to become distorted.

    To have a button with an image that completely covers it, you can use something like this:

    
    

    For a full tutorial on creating buttons with custom skins and the use of selectors to manage their states, you can check a tutorial I've written some time ago here (Creating a custom Android button with a resizable skin).

提交回复
热议问题