1

When the user is click on the line in EditText in Huawei device he get another smell line (under the long line) - see image.

I try to do a lot of thing to fix it and I don't find what should I do.enter image description here

The is my code:

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_below="@+id/static_relative_layout"
    android:background="@color/app_default_background"
    android:fitsSystemWindows="true">


        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:paddingTop="10dp">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="50dp"
                    android:layout_marginTop="15dp"
                    android:layout_marginRight="50dp"
                    android:orientation="vertical">


                        <android.support.design.widget.TextInputLayout
                            android:id="@+id/email_text_input_layout"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
             app:errorTextAppearance="@style/TextInputLayoutHintAppearanceError"
                           app:hintTextAppearance="@style/TextInputLayoutHintAppearanceValid">


                            <EditText
                                android:id="@+id/email_edit_text"
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:hint="@string/prompt_email"
                                android:imeOptions="actionNext"
                                android:inputType="textEmailAddress"
                                android:maxLines="1"
                                android:paddingLeft="8dp"
                                android:paddingRight="8dp"
                                android:singleLine="true"
                                android:theme="@style/EditTextStyleRedLine"
                                android:textColor="@color/new_dark_grey"/>

                              </android.support.design.widget.TextInputLayout>

The style "EditTextStyleRedLine" is as follows:

<style name="EditTextStyleRedLine" parent="@style/Widget.AppCompat.EditText"> 
    <item name="colorControlNormal">@color/grey</item> 
    <item name="colorControlActivated">@color/red</item> 
</style>
Vivi
  • 11
  • 3
  • Can we see your EditTextStyleRedLine? – Martin Lund Oct 29 '18 at 17:39
  • @MartinLund - yes. – Vivi Oct 29 '18 at 17:40
  • 1
    That's the EditText overflowing to a new line. Show the rest of the XML. – TheWanderer Oct 29 '18 at 17:45
  • Can you post all xml layout? Maybe, exist are an element, that are adjusting your layout. – Rodrigo Paixão Oct 29 '18 at 17:49
  • @TheWanderer I add it – Vivi Oct 29 '18 at 18:01
  • Wow! You have four Layout containers nested (admittedly, I do not know what the `Activity` looks like, but all I see for now is an `EditText`). And two of those are `RelativeLayout` containers (`RelativeLayout` is pretty greedy). You should consider flatting that layout--maybe have a look at `ConstraintLayout` – Barns Oct 29 '18 at 18:14
  • Instead of the `EditText` view you should try using the `TextInputEditText` view. – Barns Oct 29 '18 at 18:40

2 Answers2

1

Add a background to your edittext, this will solve your issue.

android: background="@null"

Yyy
  • 2,285
  • 16
  • 29
0

You can personalize the background by creating a new drawable resource file, res > right click drawable > new > drawable resource file. Add the following code:

 <?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape>
            <!-- Inner Shape -->
            <solid
                android:color="@color/colorWhite"/>

            <!-- OUTLINE -->
            <stroke android:width="0dp"
                android:color="#FFFFFF"/>

            <!-- CORNERS -->
            <corners
                android:radius="5dp"/>
        </shape>
    </item>

</selector>

Then you can set

android:background="@drawable/YOUR_DRAWABLE"
Matthew Mitchell
  • 514
  • 4
  • 14