0

I can't understand why there is no line under one of Plain Text fields, i have this line in android studio, but when i launch my application on my phone it dissapears. i have tried to copy xml attributes from another plain text view, but it didn't help

  1. How it looks on phone.

  2. How it look in android studio

    <TableLayout
        android:id="@+id/tableLayout"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="16dp"
        android:layout_marginTop="16dp"
        android:layout_marginEnd="16dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/registration_text_view">
    
        <TableRow
            android:layout_width="match_parent"
            android:layout_height="match_parent">
    
            <TextView
                android:id="@+id/textView3"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginEnd="8dp"
                android:layout_weight="1"
                android:text="@string/nickname_def_text"
                android:textAlignment="center"
                android:textSize="18sp" />
    
            <EditText
                android:id="@+id/nickname_edit_text"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:autofillHints=""
                android:ems="10"
                android:inputType="textEmailAddress"
                android:textColor="#3A433D" />
        </TableRow>
    
        <TableRow
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
    
            <TextView
                android:id="@+id/textView5"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginEnd="8dp"
                android:layout_weight="1"
                android:text="@string/email_def_text"
                android:textAlignment="center"
                android:textSize="18sp" />
    
            <EditText
                android:id="@+id/email_edit_text"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:autofillHints=""
                android:ems="10"
                android:inputType="textEmailAddress"
                android:textColor="#3A433D" />
    
        </TableRow>
    
        <TableRow
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
    
            <TextView
                android:id="@+id/textView2"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginEnd="8dp"
                android:layout_weight="1"
                android:text="@string/password_def_text"
                android:textAlignment="center"
                android:textSize="18sp" />
    
            <EditText
                android:id="@+id/password_edit_text"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:autofillHints=""
                android:ems="10"
                android:inputType="textPassword"
                android:textColor="#3A433D" />
        </TableRow>
    
        <TableRow
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
    
            <Button
                android:id="@+id/register_btn"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_marginTop="16dp"
                android:layout_weight="1"
                android:text="@string/register_btn"
                android:textColor="#3A433D" />
        </TableRow>
    
    </TableLayout>
    
Pixel
  • 35
  • 7
  • 1
    Have you tried selecting other `EditText` in launched application to check whether it appears for the first one and hides the selected one's underline? it might be the selector as by default the first `EditText` view get the focus on `Activity` start. – Lalit Fauzdar Aug 27 '20 at 20:05
  • Yeah, i see, how can i keep this line when EditText in focus? – Pixel Aug 27 '20 at 20:09
  • 1
    Also, check the first `TableRow`, only its height is set as `match_parent`. – Lalit Fauzdar Aug 27 '20 at 20:09
  • So, does it appear when you select any other `EditText`? – Lalit Fauzdar Aug 27 '20 at 20:10
  • Yes, this line appears when i select another EditText – Pixel Aug 27 '20 at 20:11
  • When an `EditText` is selected, the color you set for `colorControlActivated` is used from the theme for the underline which in your case is probably same as the background and not transparent. You can either set a background tint to the `EditText` as `android:backgroundTint="your_color"` or can set a theme to it as answered [here](https://stackoverflow.com/a/48540695/8244632). – Lalit Fauzdar Aug 27 '20 at 20:18
  • @LalitFauzdar, yes, problem was in colors, i've made theme for this `EditText` with changed colors and it works. – Pixel Aug 27 '20 at 21:14

0 Answers0