[go: nahoru, domu]

blob: 771bd315caf0560294ee89344051784cb6a3ae7f [file] [log] [blame]
Anastasia Soboleva1de1d102019-09-30 16:48:31 +01001/*
2 * Copyright 2019 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Louis Pullen-Freilich623e4052020-07-19 20:24:03 +010017package androidx.compose.foundation.layout.samples
Anastasia Soboleva1de1d102019-09-30 16:48:31 +010018
19import androidx.annotation.Sampled
Anastasia Soboleva1de1d102019-09-30 16:48:31 +010020import androidx.compose.Composable
Adam Powell999a89b2020-03-11 09:08:07 -070021import androidx.ui.core.Modifier
Louis Pullen-Freilichddda7be2020-07-17 18:28:12 +010022import androidx.compose.foundation.Box
Louis Pullen-Freilich4dc4dac2020-07-22 14:39:14 +010023import androidx.compose.ui.graphics.Color
Louis Pullen-Freilich623e4052020-07-19 20:24:03 +010024import androidx.compose.foundation.layout.aspectRatio
25import androidx.compose.foundation.layout.preferredWidth
George Mount842c8c12020-01-08 16:03:42 -080026import androidx.ui.unit.dp
Anastasia Soboleva1de1d102019-09-30 16:48:31 +010027
28@Sampled
29@Composable
30fun SimpleAspectRatio() {
Adam Powell999a89b2020-03-11 09:08:07 -070031 Box(Modifier.preferredWidth(100.dp).aspectRatio(2f), backgroundColor = Color.Green)
Anastasia Soboleva1de1d102019-09-30 16:48:31 +010032}