我在安卓电视(Jetpack Compose)实现的屏幕上工作,其中(特别是)720p电视和1080p电视的卡大小看起来不同
720:
1080:
卡代码:
...
Card(
modifier = Modifier
.width(412.dp)
.height(200.dp),
border = CardDefaults.border(border = Border.None),
colors = CardDefaults.colors(
containerColor = ColorTokens.grey_40,
contentColor = ColorTokens.white,
focusedContainerColor = Color.White,
focusedContentColor = Color.Black,
pressedContainerColor = Color.Gray,
pressedContentColor = Color.LightGray
),
shape = CardDefaults.shape (shape = RoundedCornerShape(CornerRadiusTokens.radius_300.withDPIOffset(LocalContext.current))),
onClick = { /*TODO*/ },
)
...
我希望卡在两个屏幕上看起来都一样,因为
dp
在使用中,我缺少什么?