본문 바로가기
Android

Compose Box Basic Style

by kkong93 2024. 6. 3.
반응형

여러가지 Box Style

@Preview(showBackground = true)
@Composable
private fun BoxSample() {
    Row(modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(4.dp)) {
        Box(
            modifier = Modifier
                .clip(CircleShape)
                .background(Color.Red)
                .size(44.dp)
        )

        Box(
            modifier = Modifier
                .size(44.dp)
                .clip(RoundedCornerShape(12.dp))
                .background(Color.Blue)
                .clickable { /*TODO Click*/ },
            contentAlignment = Alignment.Center,

            ) {
            Text(text = "Hello 1", color = Color.White)
        }

        Box(
            modifier = Modifier
                .size(44.dp)
                .clip(RoundedCornerShape(topStart = 12.dp))
                .clip(CutCornerShape(bottomEnd = 12.dp))
                .background(Color.Gray)
                .clickable { /*TODO Click*/ },
            contentAlignment = Alignment.Center,
        ) {
            Text(text = "Hello 2")
        }
    }
}

 

반응형

댓글