开发者

How to extend a button touch area?

I have an arrow button that I want to keep small but I want the touch area around it to be bigger.

I used the answer from the post Here but it made my button larger.

The problem is that the picture of the button is larger than the size it is presented in. But I thought there must be a way to do it without editing it or ad开发者_JAVA技巧ding a transparent button.


Use a custom button with an image with mode "center"(which means that it doesn't resize with the button size and stays always in the center). Then you can make the button as big as you want and the button image always stays in the middle with the same size.


You should be able to do it by extending the button class and overriding the hitTest method. In your version of this method you can expand the area checked to include a buffer area and return the button if the touch happens within it.


A transparent button behind this button would also work and just point that to the method... I suppose you could go about this multiple ways. One should prefer the option that is simplest with the least overhead.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜