Is there a way to allow negative decimals for TextField in Jetpack Compose on all Android versions?

592 views Asked by At

I'm trying to use an OutlinedTextField that allows both negative & positive decimal numbers. Currently, I have this code to change the keyboard type:

keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Decimal, imeAction = ImeAction.Next)

But this only allows positive numbers decimals as you can see here:

keyboard without negative sign

I feel like I must be blind or something because I can't find this trivial thing. I've seen answers on SO where the negative sign is present when they use Number, but this is not the case for me.

EDIT: Inspired by Gabriele, I did some tests on multiple Android versions and saw that it's not consistent. With Android 5.1.1 & 9 it's not present, while it is present on Android 13. Does anyone know how to force it on all versions?

0

There are 0 answers