0

If boxBackgroundColor is transparent then boxStroke is invisible

<style name="OutlinedRoundedBox" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox"> <item name="boxBackgroundColor">@android:color/transparent</item> <item name="boxStrokeColor">@android:color/white</item> <item name="boxStrokeWidth">4dp</item> </style> 

So is it only possible to have transparent TextInputLayout without outline using custom background?

E.g.:

<?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape android:shape="rectangle"> <corners android:radius="5dp" /> <stroke android:width="2dp" android:color="@color/colorEditTextOutline" /> </shape> </item> </layer-list> 

1 Answer 1

3

If you had posted a design for it then it would have been easier understand. For this solution If I understand you correctly, you need to add these two things

In style add:

<style name="InputLayoutStyle" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"> <item name="boxStrokeColor">@color/text_input_box</item> </style> 

Add color resource:

<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:color="@color/red_bright" android:state_focused="true" /> <item android:color="@color/red_bright" android:state_hovered="true" /> <item android:color="@color/red_bright" /> </selector> 

This solution will have something like this if this is what you want this is the design whig has whiteBG

Sign up to request clarification or add additional context in comments.

1 Comment

yes, it's what I needed, now I see outline and I have transparent background, and there is no need to set custom background

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.