Home > Software design >  EditText not showing the hint or the outline box until focused
EditText not showing the hint or the outline box until focused

Time:04-29

I saw that there are numerous threads raised on this topic but none of them seems to solve my issue.

I have an EditText inside of InputLayout and it shows blank until focused.

<com.google.android.material.textfield.TextInputLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
            android:layout_marginTop="20dp"

            >
            <com.google.android.material.textfield.TextInputEditText
                android:id="@ id/etInput"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:textColor="@color/black"
                android:hint="Name"/>

Android version 12enter image description here

CodePudding user response:

<com.google.android.material.textfield.TextInputLayout                   
                style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="Name"
                app:hintTextColor="@color/black"
                app:boxStrokeColor="@color/black"
                android:layout_marginTop="20dp"
                app:boxStrokeWidth="2dp"
                android:textColorHint="@color/black"
                >

                <EditText
                    android:id="@ id/etInput"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"                      
                    android:textColor="@color/black"
/>
</com.google.android.material.textfield.TextInputLayout>
  • Related