简体   繁体   English

Jetpack Compose 中的 Surface 和 Card 有什么区别?

[英]Whats the difference between Surface and Card in Jetpack Compose?

It's basically the same right?基本上是一样的吧? They have the same properties.它们具有相同的属性。 I really don't know when I have to use each.我真的不知道我什么时候必须使用每个。

Technically Cards is for a Card view but Surface have the same properties like elevation and border从技术上讲,卡片用于卡片视图,但 Surface 具有相同的属性,例如elevationborder

If you look at Card composable source you will understand that card is a surface with default elevation and, the background shape is MaterialTheme.shapes.medium如果您查看 Card 可组合源,您将了解卡片是具有默认高度的表面,并且背景形状是 MaterialTheme.shapes.medium

as the documentation "Cards are Surfaces that display content and actions on a single topic."正如文档“卡片是在单个主题上显示内容和操作的表面”。

It's all about Material Design Guidelines这都是关于材料设计指南

When you read the Material Design documentation , you will understand that these two components are used for different purposes.当您阅读 Material Design文档时,您将了解这两个组件用于不同的目的。

Surface is used when you want a surface for your UI , you can set the background color, shape etc.当您想要UI的表面时使用Surface ,您可以设置background颜色、形状等。

Card on the other hand, have default elevation(Material Design Standard) and pretty much have every property as the surface .另一方面, Card具有默认高程(材料设计标准)并且几乎所有属性都作为surface

It's All about following Material Design Guidelines一切都是为了遵循材料设计指南

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Jetpack Compose:Modifier.heightIn(…) 与 Modifier.prefferedHeigh(…) 之间的区别是什么 - Jetpack Compose: Whats the difference between Modifier.heightIn(…) vs Modifier.prefferedHeigh(…) 喷气背包中 +(...)% colors 的表面组成 - Surface at +(...)% colors in jetpack compose Jetpack Compose 中记住和记住更新状态的区别? - Difference between remember and rememberUpdatedState in Jetpack Compose? Jetpack compose 如何将卡片中的线圈图像表面与卡片底部对齐? - Jetpack compose how to allign surface over coil image in card to the bottom of the card? Jetpack Compose 卡上的事件处理 - Event Handling on a Jetpack Compose Card Android 中的卡片轮播与 Jetpack Compose - Card carousel in Android with Jetpack Compose Jetpack Compose 中 Box 内组件中的 `fillMaxSize()` 和 `matchParentSize()` 之间有什么区别? - What is the difference between `fillMaxSize()` and `matchParentSize()` in a component inside a Box in Jetpack Compose? jetpack compose 中的 MutableStateFlow("") 与 mutableStateOf("") 有什么区别? - what is thee difference between MutableStateFlow("") vs mutableStateOf("") in jetpack compose? android jetpack compose中的“remember”和“mutableState”有什么区别? - What is the difference between "remember" and "mutableState" in android jetpack compose? Jetpack Compose 中列和行的 Expanded 和 LayoutSize.Expand 的区别 - Difference Between Expanded and LayoutSize.Expand for Column and Row in Jetpack Compose
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM