yes, this underline is a background, which is probably ColorStateList
(e.g. it changes color when pressed), but if you run your code on Android 4.x or older (pre Material Design) then this background is fixed bitmap/drawable
EditText
have an android:background
attribute, but it is also present for all other View
s. so it is set inside source code of View
, not extending EditText
. and pointer to the proper drawable of background is set by styling/theming (in HERE you have some example)
EditText
is using TextPaint
(getPaint
method) which may be used to add some extra spacing between/over/under/next to letters to ensure not-overlaying. also drawable may have padding
attribute - may draw line in last row of pixels but set bottom padding to 1px
and that ensures that content of this View
(in this case EditText
) will not be drawn under/over padding (but drawable does) - sooner View
will expand a bit if have wrap_content
for height
sorry for not-so-precise answer, topic needs more inwestigation and searching in sources, but maybe my points will help you find answers by yourself