有没有一种方法我可以创建其形状为三角形按钮? 我知道我可以把一个三角形图像作为背景,但是这样会让三角形可点击以外的区域。 有没有一种方法来赛格按钮角X和Y,所以我可以使它三角形?
Is there a way I can create a button which is shaped as a triangle? I know I can put a triangle image as background, but this will make the area outside the triangle clickable. Is there a way to sey the button corners X and Y so I could make it triangular?
您可以覆盖 OnTouch 事件在CustomView /的CustomButton方法
You can override the OnTouch Event method in a CustomView / CustomButton
在里面你有MotionEvent是你可以检查是否触摸是你的三角形内(有一些数学的帮助:P)
Inside you have the MotionEvent were you can check if the Touch was inside your Triangle (with the help of some mathematics :P)