1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Android Studio・Kotlin・Jetpack ComposeでシンプルなTextfieldを作ろうとしたときに起こったエラー

Posted at

環境

  • Android Studio
  • サンプルプロジェクトにあるcompose projectを選択
build.gradle
buildscript {
    ext {
        compose_ui_version = '1.1.1'
    }
}// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
    id 'com.android.application' version '7.3.0' apply false
    id 'com.android.library' version '7.3.0' apply false
    id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
}

エラー詳細

https://developer.android.com/jetpack/compose/text
テキスト入力を作成するために、ドキュメントのサンプル

@Composable
fun SimpleFilledTextFieldSample() {
    var text by remember { mutableStateOf("Hello") }

    TextField(
        value = text,
        onValueChange = { text = it },
        label = { Text("Label") }
    )
}

をそのままコピーしたところ、Textに赤色の下線が表示され、
None if the following functions can be called with the Arguments supplied というエラーが表示された。
※エラー解決後に再現しようとしたが再現できなかった。

解決方法

Text("Label")Text(text = "Label")と引数の名前を付けたところ、エラーが解消された。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?