Android: Creating shaped button

前端 未结 4 1836
别那么骄傲
别那么骄傲 2020-12-03 09:06

How can I create a custom button like this?

\"enter

It should be just clickabl

4条回答
  •  青春惊慌失措
    2020-12-03 09:23

    save that as a png and and put it in your drawables folder. Then in your xml use something like this

    I am not 100% positive that the corner cut out is going to work properly. That corner area that is gone may end up being clickable. If that is the case and if you don't want it to be then you'll have to slice your picture in half somewhere create two buttons that you can set next to each other to make up that shape and use the same click listener for both. From the users perspective it will still seem like one button.

提交回复
热议问题