Android TextInputLayout boxColorBackground enabled="false" state not showing the enabled state that is set in style in color selector

31 views Asked by At

I have a <com.google.android.material.textfield.TextInputLayout> that is not behaving!

I have set as a style a color selector for the boxBackgroundColor. The selector is working for the focused & non-focused states. This TextInputLayout has a disabled state; which I am setting in the onBind of a RecycleView.ViewHolder. The state doesn't move from enabled. to disabled. I am also not doing anything in the onCreateViewHolder explicitly setting the state. I have tried setting everything non enabled & non clickable, including the edit-text & also have tried setiing with post delayed.

The edit text is being properly disabled, as it is unclickble. and I tested with another field; the post delay are updating other similar fields.

This really seems like an Android bug. Is there anything else I should be doing besides setting the field with the color selector?

I thought about just setting the background programmatically or going into the code and seeing if I can override some broken function that finds the enabled state and then looks for the right state with the color-selector; or using a background drawable

Here is my color selector by the way.

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:color="?attr/container_default" android:state_enabled="true" />
    <item android:color="?attr/container_default" android:state_focused="true" />
    <item android:color="?attr/container_default" android:state_focused="false" />
    <item android:color="?attr/interactive_form" android:state_enabled="false" />
    <item android:color="?attr/container_default" android:state_hovered="true" />
    <item android:color="?attr/container_default" android:state_hovered="false" />
    <item android:color="?attr/container_default"/>
</selector>
0

There are 0 answers