Reputation: 3664
please I try to resolve this problem for two days, but unsuccessfull
I have a problem with new material design components
I used style Widget.MaterialComponents.TextInputLayout.OutlinedBox
I try get this result.. (without change theme colors) only xml or code
my actual widget.. :(
my Theme
Theme.MaterialComponents.Light.NoActionBar.Bridge
xml code of component
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/core_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
style="@style/TextInputLayout"
app:errorEnabled="true"
android:layout_weight="9">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/name_edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
tools:hint="Trip name"/>
</com.google.android.material.textfield.TextInputLayout>
style
<style name="TextInputLayout" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox">
<item name="hintTextAppearance">@style/HintText</item>
</style>
<style name="HintText" parent="TextAppearance.MaterialComponents.Subtitle2">
<item name="android:textColor">?secondaryVariant</item>
</style>
I tried everything from internet, but i dont know where is a problem. thanks for any help
In gradle i have all latest versions of libs and build version
If zou want additional info write.
Thanks for any help
Upvotes: 1
Views: 2564
Reputation: 3664
this problem can resolve with this lines in custom theme
<item name="colorPrimary">?secondary</item>
<item name="colorPrimaryDark">?secondaryVariant</item>
<item name="colorOnPrimary">?onSecondaryH</item>
<item name="colorSecondary">?primary</item>
<item name="colorOnSecondary">?onPrimaryH</item>
Upvotes: 1
Reputation: 196
<style name="TextInputLayout" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox">
<item name="colorAccent">@color/HintText</item>
</style>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/core_text"
style="@style/TextInputLayout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="9"
android:theme="@style/TextInputLayout"
app:errorEnabled="true">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/name_edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
tools:hint="Trip name" />
</com.google.android.material.textfield.TextInputLayout>
Also if you need to change box stroke, you need to the override default color
<color name="colorTextInputStroke">#CCD1D3</color>
<color name="mtrl_textinput_default_box_stroke_color" tools:override="true">
@color/colorTextInputStroke
</color>
Upvotes: 1