所以,我遇到了类似的问题,对于
OutlinedTextField
的定义条件
UnfocusedBorderThickness = 1.dp
我并不满意。
我尝试了几个选项,对我有效的解决方案是自定义的一个。我正在使用
BasicTextField
与
OutlinedTextFieldDefaults.DecorationBox
和
OutlinedTextFieldDefaults.ContainerBox
。
var searchText by rememberSaveable { mutableStateOf("") }
val interactionSource = remember { MutableInteractionSource() }
BasicTextField(
value = searchText,
singleLine = true,
interactionSource = interactionSource,
cursorBrush = SolidColor(Color.White),
onValueChange = { newText -> searchText = newText }
) { innerTextField ->
OutlinedTextFieldDefaults.DecorationBox(
value = searchText,
innerTextField = innerTextField,
enabled = true,
singleLine = true,
interactionSource = interactionSource,
visualTransformation = VisualTransformation.None,
placeholder = {
Text(
text = stringResource(R.string.text),
)
},
container = {
OutlinedTextFieldDefaults.ContainerBox(
enabled = true,
isError = false,
interactionSource = interactionSource,
colors = OutlinedTextFieldDefaults.colors(),
shape = RoundedCornerShape(Dimens.ActionButtonRadius),
focusedBorderThickness = 5.dp,
unfocusedBorderThickness = 5.dp
)
}
)
}
OutlinedTextField
ж—¶еўһеҠ иҫ№жЎҶе®ҪеәҰзҡ„й—®йўҳгҖӮ - Wahib Ul Haq