以下这些函数都无法使用提供的参数进行调用。文本组合?

huangapple go评论58阅读模式
英文:

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&lt;String, InlineTextContent&gt; = ..., (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&#39;s because there is no Text function with `colors` param. It&#39;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>



huangapple
  • 本文由 发表于 2023年2月18日 23:39:35
  • 转载请务必保留本文链接:https://go.coder-hub.com/75494423.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定