0

I have an edittext and I am changing his background at one moment with:

EditText textEmail;
textEmail.setBackgroundColor(Color.RED);

The problem is that the edittext outline disapears and I have a big red thing on the screen. How I can change this, maybe set a bigger outline ...

Here is my XML layout:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bg_white" >

<ImageView
    android:id="@+id/imageView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    android:background="@null"
    android:src="@drawable/bg_mdpi" />

<EditText
    android:id="@+id/editText2"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:hint="Password"
    android:inputType="textPassword"
    android:password="true" 
    android:maxWidth="220px"/>

<Button
    android:id="@+id/button1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_below="@+id/editText2"
    android:layout_marginTop="35dp"
    android:minWidth="220px"
    android:onClick="goLoging"
    android:text="Login" />

<Button
    android:id="@+id/button2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBaseline="@+id/button1"
    android:layout_alignBottom="@+id/button1"
    android:layout_alignParentRight="true"
    android:minWidth="220px"
    android:text="Forgot Password" />

<ProgressBar
    android:id="@+id/progressBar1"
    style="?android:attr/progressBarStyleLarge"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBottom="@+id/imageView1"
    android:layout_centerHorizontal="true"
    android:layout_marginBottom="52dp"
    android:visibility="gone" />

<EditText
    android:id="@+id/editText1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignTop="@+id/imageView1"
    android:layout_centerHorizontal="true"
    android:hint="Email Adress"
    android:inputType="textEmailAddress" />

</RelativeLayout>
Cœur
  • 37,241
  • 25
  • 195
  • 267
Milos Cuculovic
  • 19,631
  • 51
  • 159
  • 265

1 Answers1

1

Just fix the EditText height and check. It may be because of wrap_content.

user936414
  • 7,574
  • 3
  • 30
  • 29
  • Thank you, the Yakoub's response helped me partially, now, the Edittext will not touch the boards but I am loosing the outline of my EditText, everything is in red, the outline has disapeared. – Milos Cuculovic Feb 07 '12 at 10:36
  • The outline will disappear as the setBackgroundColor method belongs to View class. If you want the outline also use a custom image or draw on the EditText – user936414 Feb 07 '12 at 10:56