要解释我想说的话,请看下面的图片。第一张照片是帧的旧行为。其外观与Android中的CardView一模一样,第二张图片是Xamarin.Forms 3.1.0版的新行为。框架没有立面和阴影。
老行为:
新行为
这是我使用框架的代码(对于Android平台,CardView是一个简单的框架)
<customViews:CardView>
<StackLayout Spacing="0">
<StackLayout.Margin>
<OnPlatform x:TypeArguments="Thickness" Android="16"/>
</StackLayout.Margin>
<ContentView>
<OnPlatform x:TypeArguments="View">
<OnPlatform.iOS>
<customViews:HeaderDivider/>
</OnPlatform.iOS>
</OnPlatform>
</ContentView>
public class CardView : Frame
{
public CardView()
{
Padding = 0;
if (Device.RuntimePlatform == Device.iOS)
{
HasShadow = false;
OutlineColor = Color.Transparent;
BackgroundColor = Color.Transparent;
}
}
}