我在应用程序中使用 TextInputLayout,并且想更改 boxStroke 颜色。我使用 app:boxStrokeColor = "@color/white"来更改 Box Stroke 颜色,但 BoxStrokeColor 的颜色没有改变。
但是,当我将以下代码块添加到 color.xml 中时,当我在应用程序中使用它时,它会影响应用程序中所有 TextInputLayout 的 boxStrokeColor。
<colorname="mtrl_textinput_default_box_中风_color"tools:override="true">@color/white 如何解决该问题?相关代码块
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColorHint="@color/LightBlue"
android:theme="@style/ThemeOverlay.AppTheme.TextInputEditText.Outlined"
app:boxStrokeColor="@color/white"
app:boxStrokeWidth="3dp"
app:startIconTint="@color/white">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/numberOfPlayer_txt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="numberDecimal"
android:focusable="true"
android:focusableInTouchMode="true"
android:textColor="@color/gold"
/>
</com.google.android.material.textfield.TextInputLayout>
Run Code Online (Sandbox Code Playgroud)
很有型 :
<style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar.Bridge">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppBaseTheme" parent="Theme.MaterialComponents.Light.NoActionBar.Bridge">
<item name="android:windowBackground">@color/Thistle</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
</style>
<style name="ThemeOverlay.AppTheme.TextInputEditText.Outlined" parent="">
<item name="colorPrimary">@color/white</item>
<item name="boxCornerRadiusBottomEnd">20dp</item>
<item name="boxCornerRadiusBottomStart">20dp</item>
<item name="boxCornerRadiusTopEnd">20dp</item>
<item name="boxCornerRadiusTopStart">20dp</item>
<item …Run Code Online (Sandbox Code Playgroud)