I'm using
implementation 'com.google.android.material:material:1.3.0'
My code is
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/til_holamundo"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="HOLA MUNDO">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/tiet_holamundo"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</com.google.android.material.textfield.TextInputLayout>
and it appears like this.
and if I put the selector on top it looks like this.
all very well now I add the enable false so that it cannot be edited.
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/til_holamundo"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="HOLA MUNDO">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/tiet_holamundo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:enabled="false"
/>
</com.google.android.material.textfield.TextInputLayout>
and it looks exactly the same.. this way.
my idea is to identify when it is on enable and display it in another color (as if I were giving it a boxBackgroundColor)
for example like this.
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/til_holamundo"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:boxBackgroundColor="@color/solid_yellow"
android:hint="HOLA MUNDO">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/tiet_holamundo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:enabled="false"
/>
</com.google.android.material.textfield.TextInputLayout>
and look like this.
TEST 1
I create a color/text_input_layout_stroke_color selector
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/solid_blue" android:state_focused="true"/>
<item android:color="@color/solid_yellow" android:state_hovered="true"/>
<item android:color="@color/solid_green" android:state_enabled="false"/>
<item android:color="@color/solid_red"/>
</selector>
I add it to TextInputLayout
app:boxBackgroundColor="@color/text_input_layout_stroke_color"
but it never detects the TextInputEditText if it is in enable false state . in my case it always shows red
TEST 2
I create a selector in drawable/txt_selec
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/yellow" android:state_enabled="true" android:state_selected="true"/>
<item android:drawable="@drawable/red" android:state_enabled="true"/>
<item android:drawable="@drawable/blue" android:state_enabled="false"/>
</selector>
and add it in the TextInputEditText
android:background="@drawable/txt_selec"
and indeed I manage to detect the enable and it does it correctly. but the layout of the TextInputLayout is completely lost
enable = true
enbale = false
How can I make it take the correct layout?