Can I increase a buttons onclick-area programmatically?

后端 未结 8 1985
孤独总比滥情好
孤独总比滥情好 2021-02-01 16:34

Sometimes I have a button in my UI that it is so small that it is difficult to click. My solution so far has been to add a transparent border around the button in photoshop. Jus

8条回答
  •  一向
    一向 (楼主)
    2021-02-01 16:55

    I think your solution is the best one available at the moment, if you don't want to go deep into some android stuff and intercept all the motionEvent and TouchEvents yourself and then you also would need to trigger the pressed view of the button yourself etc.

    Just create a nine patch image with a stretchable transparent border. In that way you can change the size of the image without the need to change the image itself and your button will grow or shrink without the actual displayed background changing.

提交回复
热议问题