Left Icon in TextInputLayout

Make sure you are using the latest Design library, all you need for both Design and AppCompat is: compile ‘com.android.support:design:23.2.0′ Try using both the Design’s library TextInputLayout and AppCompat’s AppCompatEditText. <android.support.design.widget.TextInputLayout android:layout_width=”match_parent” android:layout_height=”wrap_content” android:layout_gravity=”center” android:textColor=”@android:color/white” android:textColorHint=”@color/loginHint”> <android.support.v7.widget.AppCompatEditText android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:imeOptions=”actionNext” android:inputType=”textEmailAddress|textNoSuggestions” android:minWidth=”350dp” android:drawableLeft=”@drawable/ic_store_white_48dp” android:drawableStart=”@drawable/ic_store_white_48dp” android:textColor=”@android:color/white” android:textColorHint=”@color/loginHint” android:textCursorDrawable=”@null” app:backgroundTint=”@android:color/white”/> </android.support.design.widget.TextInputLayout>

Jetpack Compose: Custom TextField design

You can use the TextField: removing the label with label = null applying custom color with the TextFieldDefaults.textFieldColors parameter to hide the indicator. adding in the onValueChange a function to fix the max number of characters as described here Finally use a Column to add 2 Text composables to complete the external label and counter … Read more

Error text in TextInputLayout is covered by keyboard

Update: looks like this might have been fixed in 1.2.0-alpha03 version of the library. To make sure the error message is visible without the user acting to see it, I subclassed TextInputLayout and placed it inside a ScrollView. This lets me scroll down if needed to reveal the error message, on every occasion the error … Read more

Change to custom icon from eye-icon(default) for hide-show password in android EditText

Create a new drawable file and named it as show_password_selector.xml <?xml version=”1.0″ encoding=”utf-8″?> <selector xmlns:android=”http://schemas.android.com/apk/res/android”> <item android:drawable=”@drawable/ic_visibility_black_18dp” android:state_checked=”true”/> <item android:drawable=”@drawable/ic_visibility_off_black_18dp”/> </selector> and in your layout file, add app:passwordToggleDrawable attribute in TextInputLayout : <android.support.design.widget.TextInputLayout android:id=”@+id/layoutTextInput” app:passwordToggleEnabled=”true” app:passwordToggleDrawable=”@drawable/show_password_selector” android:textColorHint=”@color/gray”> <android.support.v7.widget.AppCompatEditText android:id=”@+id/editTextValue” android:imeOptions=”actionNext” android:layout_marginBottom=”8dp” android:inputType=”text”/> </android.support.design.widget.TextInputLayout> For Reference: https://www.youtube.com/watch?v=dW0YIV0Z9qk

Jetpack Compose how to remove EditText/TextField underline and keep cursor?

You can define these attributes to apply a Transparent color: focusedIndicatorColor unfocusedIndicatorColor disabledIndicatorColor Something like: TextField( //.. colors = TextFieldDefaults.textFieldColors( textColor = Color.Gray, disabledTextColor = Color.Transparent, backgroundColor = Color.White, focusedIndicatorColor = Color.Transparent, unfocusedIndicatorColor = Color.Transparent, disabledIndicatorColor = Color.Transparent ) ) Starting with 1.2.0 you can also use the new OutlinedTextFieldDecorationBox together with BasicTextField customizing the … Read more

Issue: change border color or box stroke for unfocused TextInputLayout in android

If you want to set the color for the outline box in unfocused mode instead of the default black, you have to add this line in colors.xml file which will override the default color for the outline box. copy this line as it is. you can change color to what you want. <color name=”mtrl_textinput_default_box_stroke_color”>#fff</color> until … Read more

How to make TextInputLayout hint asterisk red for required fields

You can use the Material Components Library. Starting from the 1.2.0-alpha05 you can format the hint text. For example you can just use something like: <com.google.android.material.textfield.TextInputLayout android:hint=”@string/hint_test” …> with: <string name=”hint_test”>Legal name <font color=”#FF0000″>*</font></string>

TextInputLayout and AutoCompleteTextView

Now, with AndroidX you don’t need customise something. Need just add material component style (was added in 1.1.0-alpha06, see release notes). <com.google.android.material.textfield.TextInputLayout android:layout_width=”match_parent” android:layout_height=”wrap_content” android:hint=”Example TextInputLayout”> <androidx.appcompat.widget.AppCompatAutoCompleteTextView style=”@style/Widget.MaterialComponents.AutoCompleteTextView.FilledBox” android:layout_width=”match_parent” android:layout_height=”wrap_content”/> </com.google.android.material.textfield.TextInputLayout>