Skip to content
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright 2026 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.example.compose.snippets.images

import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.painter.Painter

// [START android_compose_graphics_images_optimization]
// Prefer this:
@Composable
fun MyImage(url: String) {

}
// Over this:
@Composable
fun MyImage(painter: Painter) {

}
// [END android_compose_graphics_images_optimization]
Original file line number Diff line number Diff line change
Expand Up @@ -854,3 +854,13 @@ fun ScrollingGrid() {
}
}
// [END android_compose_layout_scrollable_grid]

@Composable
private fun LazyVerticalGridAdaptiveSample() {
// [START android_compose_layout_scrollable_grid_adaptive]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the visible snippet on DAC does not compile, let's change the visible code so that it does compile, so we should omit the exclude tags

LazyVerticalGrid(
columns = GridCells.Adaptive(minSize = 20.dp)
) {}
// [END android_compose_layout_scrollable_grid_adaptive]
}

Loading