RSS

Android EditText control: using old rectangle style

26 Aug

The latest android EditText looks like this (below left:

image   image

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:

image

  • Next, in your activity’s layout xml file, append below 1-line code:

image

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!

 
5 Comments

Posted by on August 26, 2013 in Android, Java, Programming

 

Tags: , , , ,

5 responses to “Android EditText control: using old rectangle style

  1. Eishia B. Konno

    November 3, 2013 at 10:45 pm

    thanks! 😀

     
  2. gedr

    August 31, 2014 at 9:28 am

    Thanks!

     
  3. Praveen Kumar

    August 31, 2014 at 9:50 pm

    thanks ……..working perfect….

     
  4. NIKET KUMAR PANDEY

    April 1, 2016 at 8:17 pm

    Nice one, Very helpful

     

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: