0

我需要创建一个自定义软件键盘并在顶部添加 3 个按钮:下划线、粗体、斜体按钮。

单击 TextField 时,我需要能够显示此自定义键盘。

TextField(
    value = textValue,
    modifier = Modifier
        .padding(16.dp)
        .fillMaxWidth(),
    placeholder = { Text(text = "John Doe") },

    textStyle = TextStyle(
        color = Color.Gray,
        fontSize = 20.sp,
        //  fontWeight = FontWeight.Bold,
        //  textDecoration = TextDecoration.Underline
    ),

    // Update value of textValue with the latest value of the text field
    onValueChange = {
        textValue = it
    },

    keyboardOptions = KeyboardOptions(imeAction = ImeAction.Done),
    keyboardActions = KeyboardActions(
        onDone = {
            keyboardController?.hide()
            // do something here
        }
    )

另外,当用户点击 TextField 时如何调用自定义键盘?

4

0 回答 0