0
2

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.

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,
        )
    )
}

こちらのコードのkeyboardType = KeyboardType.Text
ここの部分で変更することが可能です。

KeyboardTypeの種類

KeyboardType 画像
Text スクリーンショット 2024-05-26 10.36.53.png
Ascii スクリーンショット 2024-05-26 10.38.07.png
Number スクリーンショット 2024-05-26 10.39.01.png
Phone スクリーンショット 2024-05-26 10.40.01.png
Uri スクリーンショット 2024-05-26 10.41.46.png
Email スクリーンショット 2024-05-26 10.42.36.png
Password スクリーンショット 2024-05-26 10.43.32.png
NumberPassword スクリーンショット 2024-05-26 10.44.27.png
Decimal スクリーンショット 2024-05-26 10.45.51.png
0
2
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
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?