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

Android75

04/01/2022, 3:34 AM
i don’ tr want use ConsrtrainsLayout but i have to develop a splashscreen with big log to cenrter and a little text (copyright) to bottom. what layout can use Box or two Box? I used two Box
Copy code
Box(modifier = Modifier
    .fillMaxSize()
    .background(BlueDentPad), contentAlignment = Alignment.Center) {
    Image(
        painter = painterResource(id = R.drawable.logo), contentDescription = null,
        contentScale = ContentScale.FillWidth,
        modifier = Modifier
            .padding(10.dp)
    )
    
}

Box(modifier = Modifier
    .fillMaxSize().padding(10.dp), contentAlignment = Alignment.BottomCenter) {
    Text(text = "Company © 2022", color = Color.White, textAlign = TextAlign.Center)

}
r

Ritwik Raj Srivastava

04/01/2022, 5:32 AM
You can use a single box with .fillMaxSize() and then place elements inside with .align modifier. This will help you to not worry even for small screen devices @Android75
a

Android75

04/01/2022, 5:36 AM
Copy code
Box(modifier = Modifier
    .fillMaxSize()
    .background(BlueDentPad) ) {
    Image(
        painter = painterResource(id = R.drawable.logo), contentDescription = null,
        contentScale = ContentScale.FillWidth,
        modifier = Modifier
            .padding(10.dp), alignment = Alignment.Center
    )

}
Logo is top left not center
ah Modifir.align
it works, thanks
🙌 1
r

Ritwik Raj Srivastava

04/01/2022, 5:39 AM
@Android75 Let me know if you work it out. Or else, Ill provide you a snippet
a

Android75

04/01/2022, 5:40 AM
@Ritwik Raj Srivastava it works.. my error is not use Modifier.align but alignment
4 Views