0

I'm looking to create an EditText that looks like the following & was just wondering if it was possible & if anybody might be able to provide example XML code to create the following.

Note: The cursor doesn't have to be blue, if it can be that's cool, but definitely not required.

enter image description here

Galax
  • 359
  • 1
  • 13
  • 1
    In Android everything is always possible. – Booger Jun 26 '15 at 14:18
  • possible duplicate of [Declaring a custom android UI element using XML](http://stackoverflow.com/questions/2695646/declaring-a-custom-android-ui-element-using-xml) – BSMP Jun 26 '15 at 14:20
  • @Booger I have recently come to accept this. Wiser words were never spoken – Galax Jun 26 '15 at 14:25

1 Answers1

2

This is just an EditText with a custom background (the underline with the curved shape). You would just use a standard EditText, and add your custom drawable (however you make that - either a PNG, 9Patch, ShapeDrawable, etc) as the "background" element. The text label would just be a TextView you put in your layout above the EditText.

However, I would steer you to use the new "TextInputLayout" provided in the Design Support Lib. This has a ton of built in functionality, and as a bonus, your app will be consistent with Material Design standards.

Booger
  • 18,137
  • 6
  • 51
  • 64
  • Yeah, this is actually what I was just looking at. Thanks for the in-depth response! – Galax Jun 26 '15 at 14:19
  • That new control is really great (you can probably still customize the background) - it provides great hint, label and error functionality out of the box. – Booger Jun 26 '15 at 14:20