1)从服务器获取颜色
2)比将TextInputEditText的行和提示更改为颜色(适用于所有州)
要设置颜色,您可以使用:
// Sets the text color used by the hint in both the collapsed and expanded states
textInputLayout.setDefaultHintTextColor(...);
//Sets the collapsed hint text color
textInputLayout.setHintTextColor(....);
在FilledBox布局中更改下划线颜色,可以使用方法[[setBoxStrokeColor
setBoxStrokeColor(ContextCompat.getColor(this,R.color....));
您可以使用单色或类似的选择器:
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:color="?attr/colorPrimary" android:state_focused="true"/> <item android:alpha="0.87" android:color="?attr/colorOnSurface" android:state_hovered="true"/> <item android:alpha="0.12" android:color="?attr/colorOnSurface" android:state_enabled="false"/> <item android:alpha="0.38" android:color="?attr/colorOnSurface"/> </selector>