If you want to create a legitimate, fully implemented skin for a button, you can make a 9 patch using a list of states.
9-patch-drawable - standard version with sections that can be repeated; e.g. upper left, upper, upper right, middle left, etc. parts of the button.
(Here you can read the detailed information: http://developer.android.com/guide/topics/graphics/2d-graphics.html#nine-patch )
The displayed list of states is available for drawing, which changes its resource in accordance with a certain state. In the case of a button, normal, highlighted and pressed are states.
http://developer.android.com/guide/topics/resources/drawable-resource.html#StateList
Thus, you really need to make three templates with nine patches and a list of states suitable for connecting these three nine patches.
A few other ways to do this:
- Subclass a View and create your own button from scratch.
- Someone else mentioned ImageButton
source share