Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Development: How Can I Make An EditText Plain So It's Just A White Square?

As the title says, I've seen EditTexts where they are just plain white with no smooth corners or orange android border when you highlight it etc.

Like it looks in this app: http://s1.appbrain.com/screen?id=-2631427781674403509&i=1

like image 315
AlexPriceAP Avatar asked Dec 04 '10 11:12

AlexPriceAP


People also ask

How do you make a white line in EditText?

Show activity on this post. To change Edittext's underline color: Then change the “colorAccent” to whatever the color you want your EditText line color to be.

How do I change the text line color in Android?

Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main. xml. We can change color as per project requirement.

What is plain text in Android Studio?

Plaintext is nothing but the Edittext. It has changed the name in Android studio but if you check into Design view you will get to know that it still has name of Edittext only. Usages. Textview : should be used for uneditable text which user wants to read but not to manipulate.


1 Answers

You need to create a custom background 9-patch image like this one and put it to /res/drawable directory. Here is the tutorial for 9-patch images. Then you need to apply the image as a background for your EditText using android:background attribute.

Here is a sample layout xml:

<EditText
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"
    android:background="@drawable/white_bg"
    android:text="Test"
    android:layout_marginBottom="5dip" /> 

<EditText
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"
    android:background="@drawable/white_bg"
    android:text="Currently focused" />

And here is the result:

alt text

like image 183
Vit Khudenko Avatar answered Nov 11 '22 08:11

Vit Khudenko