Search code examples
androidmaterial-designandroid-textinputlayoutmaterial-components-androidmaterial-components

Changing the arrow color material ExposedDropdownMenu / TextInputLayout


I want to change the arrow color to white. how to do it? here's my code

I want to change the arrow color to white. how to do it? here's my code

<com.google.android.material.textfield.TextInputLayout
    style="@style/ExposedDropdownMenu"
    android:hint="Select"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <AutoCompleteTextView
        android:focusable="false"
        android:textSize="17sp"
        android:padding="15dp"
        android:textColorHint="@color/white"
        android:textColor="@color/white"
        android:id="@+id/actv_pool"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        tools:ignore="LabelFor" />

</com.google.android.material.textfield.TextInputLayout>

here's my style:

<style name="ExposedDropdownMenu" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu">
    <item name="boxStrokeColor">#fff</item>
    <item name="boxStrokeWidth">1dp</item>
    <item name="android:textColorHint">#fff</item>
</style>

I hope it's clear. thanks in advance.


Solution

  • You can use the app:endIconTint attribute in the layout:

     <com.google.android.material.textfield.TextInputLayout
                ...
                app:endIconTint="@color/my_selector_color">
    

    or you can use a custom style:

     <com.google.android.material.textfield.TextInputLayout
        style="@style/ExposedDropdownMenu"
        ...>
    

    with:

      <style  name="name="ExposedDropdownMenu" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu">
        <item name="endIconTint">@color/my_selector_color</item>
      </style>