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?
You can override the OnTouch Event method in a CustomView / CustomButton
Inside you have the MotionEvent were you can check if the Touch was inside your Triangle (with the help of some mathematics :P)
If you want to get exotic with non-rectangular views, then you will want to create a custom View. There is lots of information available on the web, but some of the best can be found on the Android documentation site:
http://developer.android.com/guide/topics/ui/custom-components.html#custom
来源:https://stackoverflow.com/questions/9489977/is-there-a-way-to-create-a-triangular-button-on-android