[Compose] AsyncImage CircleShape 적용되지 않을 때 contentScale 확인

blue·2023년 3월 22일
0

compose

목록 보기
1/1
post-thumbnail

Row(
        modifier = Modifier.fillMaxWidth()
    ) {
        AsyncImage(
            modifier = Modifier
                .size(200.dp)
                .clip(CircleShape),
            model = imageUrl,
            contentDescription = null
        )
        AsyncImage(
            modifier = Modifier
                .size(200.dp)
                .clip(CircleShape),
            model = imageUrl,
            contentScale = ContentScale.Crop,
            contentDescription = null
        )
    }

왼쪽 AsyncImage에서 CircleShape으로 나타나지 않는 모습을 볼 수 있습니다.
우측과 같이 CircleShape을 적용하기 위해서는 contentScale을 적용해 주어야 합니다.

contentScale = ContentScale.Crop 을 주어 CircleShape이 적용된 것을 확인할 수 있습니다.

AsyncImage에 shape을 줄 때는 contentScale 추가를 기억해두는 것이 좋겠습니다. 😎

profile
😎

0개의 댓글