如何在Jetpack Compose中裁剪容器的特定区域,同时保留底部的阴影?

huangapple go评论52阅读模式
英文:

How to crop specific areas of a container while preserving the shadow underneath in Jetpack Compose?

问题

我有一个容器(卡片、盒子或其他任何东西...)里面有两个有问题的区域,用红圈标出。我需要裁剪这些区域,同时确保底下的阴影被保留。我尝试了不同的方法,但是我找不到有效裁剪这些区域的解决方案。

英文:

I have a container (Card, Box, or whatever..) that contains two problematic areas, marked with red circles. I need to crop these areas out while ensuring that the shadow underneath is preserved.

如何在Jetpack Compose中裁剪容器的特定区域,同时保留底部的阴影?

I have tried different approaches, but I couldn't find a solution to crop the areas effectively.

答案1

得分: 1

使用.border(width = ..., color = .., CustomShape(...))修饰符与自定义形状一起使用。这里有一个详细的解释使用Jetpack Compose的自定义形状

结果:

如何在Jetpack Compose中裁剪容器的特定区域,同时保留底部的阴影?

英文:

Use the .border(width = ..., color = .., CustomShape(...)) modifier with a custom shape. Here is a detailed explanation Custom Shape with Jetpack Compose

The result:

如何在Jetpack Compose中裁剪容器的特定区域,同时保留底部的阴影?

huangapple
  • 本文由 发表于 2023年6月9日 01:18:13
  • 转载请务必保留本文链接:https://go.coder-hub.com/76434268.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定