英文:
None of the following functions can be called with the arguments supplied. text compose?
问题
在我的Compose中,以下文本出现错误,我不明白我哪里出错了。
Text(
text = stringResource(R.string.meaning_word),
modifier = Modifier
.padding(6.dp)
.align(alignment = Alignment.Start)
.fillMaxHeight(0.3f),
colors = AppColors.mOffWhite,
fontSize = 17.sp,
fontWeight = FontWeight.Bold,
lineHeight = 22.sp
)
我收到以下错误消息:无法使用提供的参数调用以下函数之一。
Text(AnnotatedString, Modifier = ..., Color = ..., TextUnit = ..., FontStyle? = ..., FontWeight? = ..., FontFamily? = ..., TextUnit = ..., TextDecoration? = ..., TextAlign? = ..., TextUnit = ..., TextOverflow = ..., Boolean = ..., Int = ..., Map<String, InlineTextContent> = ..., (TextLayoutResult) → Unit = ..., TextStyle = ...) 在androidx.compose.material中定义
Text(String, Modifier = ..., Color = ..., TextUnit = ..., FontStyle? = ..., FontWeight? = ..., FontFamily? = ..., TextUnit = ..., TextDecoration? = ..., TextAlign? = ..., TextUnit = ..., TextOverflow = ..., Boolean = ..., Int = ..., (TextLayoutResult) → Unit = ..., TextStyle = ...) 在androidx.compose.material中定义
我尝试了以下答案,但没有帮助:https://stackoverflow.com/questions/73997891/one-of-the-following-functions-can-be-called-with-the-arguments-supplied
<details>
<summary>英文:</summary>
following text giving an error in my compose I did not understand what I am making wrong
Text(
text = stringResource(R.string.meaning_word),
modifier = Modifier
.padding(6.dp)
.align(alignment = Alignment.Start)
.fillMaxHeight(0.3f),
colors = AppColors.mOffWhite,
fontSize = 17.sp,
fontWeight = FontWeight.Bold,
lineHeight = 22.sp
)
I am getting following error None of the following functions can be called with the arguments supplied.
Text(AnnotatedString, Modifier = ..., Color = ..., TextUnit = ..., FontStyle? = ..., FontWeight? = ..., FontFamily? = ..., TextUnit = ..., TextDecoration? = ..., TextAlign? = ..., TextUnit = ..., TextOverflow = ..., Boolean = ..., Int = ..., Map<String, InlineTextContent> = ..., (TextLayoutResult) → Unit = ..., TextStyle = ...) defined in androidx.compose.material
Text(String, Modifier = ..., Color = ..., TextUnit = ..., FontStyle? = ..., FontWeight? = ..., FontFamily? = ..., TextUnit = ..., TextDecoration? = ..., TextAlign? = ..., TextUnit = ..., TextOverflow = ..., Boolean = ..., Int = ..., (TextLayoutResult) → Unit = ..., TextStyle = ...) defined in androidx.compose.material
I have tried following answer https://stackoverflow.com/questions/73997891/one-of-the-following-functions-can-be-called-with-the-arguments-supplied did not help
</details>
# 答案1
**得分**: 1
这是因为没有带有`colors`参数的Text函数。还需要将Alignment.Start更改为Alignment.Horizontal之一。
<details>
<summary>英文:</summary>
It's because there is no Text function with `colors` param. It's color also you need to change Alignment.Start which is Alignment.Horizontal to one of
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/DvYhY.png
</details>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论