I am trying to add an end Icon Drawable to my text input layout. I've come across the methods to do so but when I try to implement it, it does not work.
Material io says that all that is needed to display a trailing icon is to add app:endIconDrawable="@drawable/your_icon_here"
When I do this I do not get an icon to display. The Icon I am using was downloaded as an SVG from Google's material icons library and I imported it into project as a vector asset.
Below is my code and a picture of the results I get. (I've broken the lines to make finding the call for the icon easier)
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/input_layout_event_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:hint="@string/ec_event_name"
app:endIconDrawable="@drawable/ic_event_black_24dp"
app:errorEnabled="false"
app:boxBackgroundColor="@android:color/transparent"
android:background="@android:color/transparent">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/input_event_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textAutoCorrect" />
</com.google.android.material.textfield.TextInputLayout>
Any help is appreciated!
End icon isn't visible because it's disabled by default (END_ICON_NONE). Add this attribute to TextInputLayout
:
app:endIconMode="custom"