Time for action - styling the calculator buttons
The next thing we need to do is use a selector-list and the nine-patch images you've just created to style the calculator buttons. We'll also be defining the button styling in a resource file so that we don't have to specify all of the styling for each of the buttons. In order to replace the standard button with our image, we only need to replace its background with the one we create for the purpose.
- In the
res/drawabledirectory, create a new XML file named
button.xmland open it in an editor.
- Define the root element of the file as a fixed-size selector:
<selector xmlns:android="http://schemas.android.com/apk/res/android" android:constantSize="true" android:variablePadding="false">
- Create the pressed ...