There are two adjacent graphic buttons. If I use the method of calculation of the coordinates touch TouchEvent, I have to create a large array of coordinates. Maybe there is another method?

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Probably not the best solution but you could overlap two buttons each representing a part of the image(the black or white) and make the rest of the
Button‘s image transparent(the images will have the same dimensions for both buttons). You’ll also need to extend theButtonclass to override how theonTouchEventmethod handles the touch events, depending on the point where the touch happened being a transparent point or an “image” point. I’ve made a small sample project obtaining aButtonwith two parts like below(ignore my design skills):You can find the project here, it’s pretty self explanatory. See if it helps you.