← ClaudeAtlas

android-image-loading-coillisted

Coil image loading patterns for Android/Compose - async images, placeholders, sizing, caching, transformations, and list performance. Use this skill whenever loading remote or local images, optimizing image-heavy screens, handling loading/error states, or deciding how images should be displayed in Compose. Trigger on phrases like "Coil", "AsyncImage", "image loading", "placeholder", "image cache", "transformations", or "loading avatars/photos".
lenorebreakneck630/claude-zero-to-hero-android-KMP · ★ 1 · AI & Automation · score 64
Install: claude install-skill lenorebreakneck630/claude-zero-to-hero-android-KMP
# Android Image Loading with Coil ## Core Principles - Load images with explicit sizing whenever possible. - Treat image loading as UI infrastructure, not business logic. - Prefer simple loading pipelines before adding transformations. - Keep loading/error UI states intentional. - Optimize for scrolling performance on image-heavy screens. --- ## Default Compose Usage For most screens, use Coil's Compose integration: ```kotlin AsyncImage( model = imageUrl, contentDescription = stringResource(R.string.cd_profile_photo), modifier = Modifier.size(64.dp), contentScale = ContentScale.Crop ) ``` This is appropriate for: - avatars - thumbnails - banners - article/product images --- ## Prefer Explicit Image Requests When Needed Use `ImageRequest` when behavior should be controlled more precisely: ```kotlin AsyncImage( model = ImageRequest.Builder(LocalContext.current) .data(imageUrl) .crossfade(true) .build(), contentDescription = stringResource(R.string.cd_cover_image) ) ``` Good reasons to use `ImageRequest`: - enable crossfade - specify placeholders or error drawables - set size or transformations - add headers or special cache behavior --- ## Loading and Error States Screens should define what happens when an image: - is loading - fails to load - is absent entirely Typical options: - placeholder while loading - fallback avatar/icon when missing - stable error UI when request fails Avoid blank flashing regions when im