现在我有一个自定义的撰写输入框。BasicTextField,但无论如何我都可以 \xe2\x80\x99t 将输入字体居中。我只能通过Box的offset属性在x方向上进行偏移。
\n之所以要自定义输入框,是因为我需要一个固定高度的输入框和字体大小。但当高度不够时,文本字段无法输入。
\n请帮助我,我更喜欢使用 TextField 编写固定高度的输入框。但在网站上并没有找到合适的解决方案。
\n这是我的自定义代码:
\n@Composable\nfun InputEditText(\n value: String,\n modifier: Modifier,\n onValueChange: (String) -> Unit,\n contentTextStyle: TextStyle,\n hintTextStyle: TextStyle,\n placeHolderString: String = "",\n enabled: Boolean = true,\n readOnly: Boolean = false,\n singleLine: Boolean = false,\n maxLines: Int = Int.MAX_VALUE,\n offsetDp: Dp = 10.dp,\n keyboardOptions: KeyboardOptions = KeyboardOptions.Default,\n keyboardActions: KeyboardActions = KeyboardActions.Default,\n cursorColor: Color = Color.Black,\n) {\n BasicTextField(\n value = value,\n onValueChange = onValueChange,\n modifier = modifier,\n textStyle = contentTextStyle,\n decorationBox = {innerTextField ->\n …Run Code Online (Sandbox Code Playgroud)