Is there an alignment option, that would always tr...
# compose
p
Is there an alignment option, that would always try to center to the center of the screen, rather than to center of parent composable? For example:
Copy code
Row {
    if (showIcon)
        BackIcon()
    // Center to the center of the screen, while maximizing available width on left and right
    Title()
}
c
I feel like I almost understand what it is you're trying to say. You want the
Title()
to be displayed center aligned regardless of if the
BackIcon()
is displayed?
p
Yeah correct. Easiest solution would be to add padding of
BackIcon()
-width to the end, but that would make available size of
Title()
smaller. I’m wondering if there is any way to avoid that.
w
There is a CenterAlignedTopAppBar which you can use as a reference, I think it allows the title to overflow.
m
Sounds like you want to use
Box
instead. You can add
horizontal
(i.e. balanced) padding to
Title
if you don’t want overlap. If you don’t want to use padding, then you have to live with possible overlap, right? Or are you saying, allow the title to be off-centre only if it would otherwise overlap the back button?