使用的默认值OutlinedTextField
定义在TextFieldDefaults.outlinedTextFieldColors
by the focusedBorderColor
, unfocusedBorderColor
, disabledBorderColor
.
With M2:
focusedBorderColor: Color = MaterialTheme.colors.primary.copy(alpha = ContentAlpha.high),
unfocusedBorderColor: Color = MaterialTheme.colors.onSurface.copy(alpha = ContentAlpha.disabled),
您可以更改colors.primary
和colors.onSurface
在你的主题中。
With M3:
focusedBorderColor: Color = OutlinedTextFieldTokens.FocusOutlineColor.toColor(),
unfocusedBorderColor: Color = OutlinedTextFieldTokens.OutlineColor.toColor(),
在这种情况下,您可以更改primary
和outline
主题中的颜色。
否则你可以override他们使用类似的东西:
OutlinedTextField(
value = "",
onValueChange = {},
label = {Text("Input")},
colors = TextFieldDefaults.outlinedTextFieldColors(
focusedBorderColor = Green,
unfocusedBorderColor = Yellow)
)