Two ways:
You have a button and a custom view in the form of FrameLayout children , with which the button can be drawn above your custom view.
You do not have a real button. Instead, draw something that looks like a button, touch touch events, especially if they are within its size, etc. This is more suitable for something like a game.
I believe that you can do # 2, but have a subclass of Button, make a drawing so that it runs exactly the same as a regular button, and just positioned / depends on your user view, but I donβt know how to do it.
source share