[英]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 具有相同的属性,例如elevation
和border
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.