https://kotlinlang.org logo
v

Vivek Sharma

02/16/2021, 10:28 AM
Prev we used Modifier.align(SomeAlignment), I guess it is changed. how to align composable , specifically in Box? [SOLVED]
d

Denis

02/16/2021, 10:31 AM
{horizontal,vertical}{Alignment,Arrangement} parameters
v

Vivek Sharma

02/16/2021, 10:40 AM
what I didnt get you
d

Denis

02/16/2021, 10:43 AM
https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/package-summary#column don't verticalArrangement, horizontalAlignment parameters do what you want?
v

Vivek Sharma

02/16/2021, 10:43 AM
I dont want to align whole content, Box have params of contentAlignment, I want to align composable inside box, like I did in my prev project like Modifier.align()
🆗 1
why only columns/rows have these params, if I want to align text or something 😅
oh sorry textAlign is there, but I was tryingn something else, maybe I will try that thanks for the time
d

Denis

02/16/2021, 10:53 AM
I've just tried Modifier.align in alpha12 and it works well. What is the problem you're experiencing?
Copy code
@Preview
@Composable
fun FPreview() {
    Box(Modifier.size(100.dp)) {
        Text("Hi, Vivek!", Modifier.align(Alignment.BottomCenter))
    }
}
v

Vivek Sharma

02/16/2021, 11:08 AM
oh, I can not use Modifier.align(), I even checked if I am not importing wrong Modifier interface
d

Denis

02/16/2021, 11:10 AM
do you use it inside Box? 'cause it's only available within BoxScope
v

Vivek Sharma

02/16/2021, 11:11 AM
oh sorry, I was not getting auto complete and I was getting some error,
I got it now, my bad, thanks for the time
❤️ 1