The onDraw(...) method is where all the magic happens for creating the lines!
As you can see from the code we are using a Canvas to draw on.
The purpose of Rect r = mRect; and int baseline = getLineBounds(i, r); is so we can get the bounds of the drawn text in the Edit text so we can draw our lines to be the same length as the text and to have the line right under the text. The purpose of super.onDraw(canvas); is so that we can draw the rest of the stuff that is normally drawn by EditText!

That's it! That is all there is to modifying existing UI components with code!

Part Two: Modifying existing UI components with XML!

To start off we first need to create a new folder called drawable under res. After that we need to add three image to that folder:
button1click
button1up
button1off