Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EditText loses its borders after failure in submission

I built a screen that looks like this:

but if login fails the screen turns out to look like this:

I used EditText and the code looks like this:

<TextView android:layout_height="wrap_content"  
            android:layout_width="wrap_content"  
            android:text="email"></TextView>  
        <EditText 
            android:layout_height="wrap_content"  
            android:layout_width="fill_parent" 
            android:id="@+id/username"
            android:hint=""
            android:textStyle="normal"
    android:singleLine="true" 
            android:inputType="textEmailAddress">                
        </EditText>  
        <TextView android:layout_height="wrap_content"  
            android:layout_width="wrap_content"  
            android:text="password">
        </TextView>  
        <EditText 
            android:layout_height="wrap_content"  
            android:layout_width="fill_parent"
            android:id="@+id/uc_txt_password" 
            android:hint=""
            android:textStyle="normal"
    android:singleLine="true"
            android:inputType="textPassword">
        </EditText>  

Any ideas?

Update: It seems that the bogus display is the way it displays on Ice-cream-sandwich by default. I am using an older version of android (2.2) on which the display looks like the first attached pic.

like image 561
Nir Alfasi Avatar asked Nov 04 '22 10:11

Nir Alfasi


1 Answers

ICS Introduces a more "open" text layout (look at the gmail app) where edit text's default style lack borders. You should more rigidly define your style to be how you want it on all devices if you don't want it to look like how the device sets it. Perhaps use some 9 patch images and state selector xml files. So if you're setting the background to something like white and not defining any other styles it might be inheriting from Holo.Dark and using this as the edit text bg: https://github.com/android/platform_frameworks_base/blob/master/core/res/res/drawable-hdpi/textfield_default_holo_dark.9.png

Thus, no visible text. Define your style more rigidly, or set your themes better and don't override the other backgrounds.

like image 93
Sleepybear Avatar answered Nov 13 '22 18:11

Sleepybear