The latest android EditText looks like this (below left:
But I was asked to use old-style rectangle style (above right) to replace the current one. Here is how it is done:
- Create a new xml file in res/drawable folder, which looks like this:
- Next, in your activity’s layout xml file, append below 1-line code:
Note I: you don’t have to create the above xml file, and you can download this 14-line rect_tex_edit.xml file and directly put it in your project’s res/drawable/ folder.
Note II : the below code might be useful, which makes the cursor and text more legible and clear in the view:
android:textColor=”@android:color/black”
android:textCursorDrawable=”@null”
That is it. Enjoy this trick!
Filed under: Android, Java, Programming Tagged: android, EditText, rectangle, style, underline
