jetpack组合高程渲染出现问题。我正在尝试在Surface上添加高程,但是我的UI似乎带有修剪的阴影。另外,如何在Surface上添加彩色阴影?
@Composable
fun DiscoverItem() {
Surface(
contentColor = Color(0xFFFFFFFF),
modifier = Modifier.preferredWidthIn(min = 145.dp).preferredHeight(56.dp),
shape = CircleShape,
elevation = 8.dp,
) {
Row(
modifier = Modifier.fillMaxSize().padding(horizontal = 8.dp),
verticalAlignment = Alignment.CenterVertically
) {
Surface(
modifier = Modifier.preferredSize(40.dp),
shape = CircleShape,
color = Color(0xFFFFC3D8)
) {
Image(
imageResource(R.drawable.pin_icon),
modifier = Modifier.size(width = 18.dp, height = 24.dp),
contentScale = ContentScale.Fit
)
}
Spacer(modifier = Modifier.padding(start = 10.dp))
Text(
"YOUR AREA",
style = MaterialTheme.typography.body2,
color = Color(0xFFFC1055)
)
}
}
}
@Composable
@Preview
fun DiscoverItemPreview() {
DiscoverItem()
}
答案 0 :(得分:1)
布局底部没有足够的内容。您可以添加间隔以查看阴影。
const functions = require('firebase-functions');
const admin = require('firebase-admin')
admin.initializeApp();
exports.updateViewCount = functions.https.onCall((data, context) => {
const postId = data.postId;
const userId = data.uid;
console.log("postId: " + postId + ", userId: " + userId);
const postsRef = admin.database().ref('/posts/${postId}/views_count');
// not sure what to do to update the views_count key using a Transaction from this point on
});
关于彩色阴影,compose min sdk是Android Lollpop,棒棒糖的Skia版本不支持彩色阴影/高程。利兰·理查森(Leland Richardson)在YouTube上有关“撰写狗粮”的视频中谈到了这个问题。 here