https://kotlinlang.org logo
#compose
Title
# compose
i

Ink

11/22/2021, 12:30 PM
That red block is my
BasicTextField()
Is it possible to center black indicator?
Copy code
BasicTextField(
    modifier = Modifier
        .fillMaxWidth()
        .align(Alignment.Center),
    value = value,
    onValueChange = { value = it },
    singleLine = true
)
n

nitrog42

11/22/2021, 12:38 PM
I don't think there is anyway to do that, you can copy and modify the code of the BasicTextField/CoreTextField to do it, but know that you are probably in for a long adventure. And that you should probably backports any new changes to the class
❤️ 1
i

Ink

11/22/2021, 12:46 PM
I"ve created my own style with
textAlign
and it works as expected
Copy code
val style = TextStyle(
    color = MaterialTheme.colors.primary,
    fontSize = 16.sp,
    fontWeight = FontWeight.SemiBold,
    textDecoration = TextDecoration.None,
    textAlign = TextAlign.Center
)
👍 1
3 Views