D.Y
D.Y

Reputation: 55

why edit text style appears different in different phones

I am trying to change my edit text style in android studio. I changed it in @drawable/edittext_design.xml folder. When I run the app on Nexus 5, it exactly runs the same as I expected. However, it runs in Google Nexus S phone different.

This is how it looks on Nexus 5:

nexus_5

This is how it looks on Nexus S

nexus_s

My edit_design.xml file

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">

    <padding
        android:top="5dp"
        android:bottom="5dp"
        android:left="7dp"
        />

    <stroke
        android:color="@color/orange"
        android:width="1dp"
        />

    <corners
        android:radius="4dp"
        />
</shape>

My main xml file

<EditText
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:id="@+id/et_Username"
        android:layout_marginTop="100dp"
        android:layout_marginLeft="60dp"
        android:layout_marginRight="60dp"
        android:textColorHint="@color/light_blue"
        android:background="@drawable/edit_design"
        android:drawableLeft="@drawable/username_icon4"
        android:hint="Kullanıcı Adı"
        android:singleLine="true"
        android:textColor="@color/light_blue"/>

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="textPassword"
        android:ems="10"
        android:id="@+id/et_Password"
        android:textColorHint="@color/light_blue"
        android:layout_marginLeft="60dp"
        android:layout_marginRight="60dp"
        android:layout_marginTop="7dp"
        android:drawableLeft="@drawable/username_icon3"
        android:hint="Şifre"
        android:singleLine="true"
        android:background="@drawable/edit_design"
        android:textColor="@color/light_blue"/>

I wanted to show edit text's backgrounds white but I'm facing black in Nexus S. Is it related API level or something? How can I fix this problem?

Thank you for helping.

Upvotes: 1

Views: 84

Answers (1)

Clark Wilson
Clark Wilson

Reputation: 389

You almost had it, try painting a white background as well, so that you are no longer dependent on the OS default color.

Put <solid android:color="@color/white"/> in your edit_design.xml file.

Upvotes: 1

Related Questions