I'm doing a calculator. So I made my Buttons with numbers and functions. The expression that has to be calculated is in a TextField because I want users can add numbers or functions also in the middle of the expression, so with the TextField, I have the cursor. But I want to disable the Keyboard when users click on the TextField.
In XML, the solution is:
public static void disableSoftInputFromAppearing(EditText editText) {
if (Build.VERSION.SDK_INT >= 11) {
editText.setRawInputType(InputType.TYPE_CLASS_TEXT);
editText.setTextIsSelectable(true);
} else {
editText.setRawInputType(InputType.TYPE_NULL);
editText.setFocusable(true);
}
}
My question: How can I do this in compose textField?
##In Compose, the solution is:
CompositionLocalProvider(
LocalTextInputService provides null
) {
TextField(
value = value,
onValueChange = { value = it },
label = { Text("The Label") }
)
}