LoginSignup
3
3

JetpackCompose TextFieldでキーボードの決定アイコンを変える方法

Posted at

TextFieldでキーボードの決定アイコンを変える方法です。

.kt
@Composable
fun CopyButton() {
    var text = remember { mutableStateOf("") }
    TextField(
        value = text.value,
        onValueChange = { text.value = it },
        label = { /*TODO*/ },
        modifier = Modifier.padding(16.dp),
        keyboardOptions = KeyboardOptions(
            keyboardType = KeyboardType.Text,
            imeAction = ImeAction.Done,
        )
    )
}

こちらのコードのimeAction = ImeAction.Done
ここの部分で変更することが可能です。

ImeActionの種類

ImeAction 画像
None スクリーンショット 2024-03-03 8.14.41.png
Default スクリーンショット 2024-03-03 8.17.34.png
Go スクリーンショット 2024-03-03 8.18.39.png
Search スクリーンショット 2024-03-03 8.20.18.png
Send スクリーンショット 2024-03-03 8.21.28.png
Previous スクリーンショット 2024-03-03 8.22.32.png
Next スクリーンショット 2024-03-03 8.23.31.png
Done スクリーンショット 2024-03-03 8.24.37.png
3
3
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
3
3