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

Karthick

02/18/2021, 9:21 AM
can AppBar has an option to center title, like in flutter. Some users prefer title in the center
AppBar(centerTitle: true, title: Text("Title"))
😿 2
a

Albert Chang

02/18/2021, 9:31 AM
Copy code
TopAppBar(
    title = {
        Text(
            text = "Title",
            modifier = Modifier.fillMaxWidth(),
            textAlign = TextAlign.Center
        )
    }
)
k

Karthick

02/18/2021, 10:33 AM
if actions are added it's not good
a

Albert Chang

02/18/2021, 11:51 AM
for custom use cases such as horizontally centering the title, use the other TopAppBar overload for a generic TopAppBar with no restriction on content.
👆 1
👍 1
2 Views