可能吗?我想删除Xamarin Forms上按钮的阴影.
谢谢
对于按钮Android上的删除阴影,您只需在项目Droid中创建渲染器并使用透明或其他颜色设置BackroundColor.
对于使用PCL的项目:
[assembly: ExportRenderer(typeof(Button),typeof(FlatButtonRenderer))] namespace Project.Droid { public class FlatButtonRenderer : ButtonRenderer { protected override void OnDraw(Android.Graphics.Canvas canvas) { base.OnDraw(canvas); } } }
在XAML中:
更详细地解释.
using Android.App; using Android.Content.PM; using Android.OS; using Xamarin.Forms.Platform.Android; using ProjectName.Droid; using Xamarin.Forms; [assembly: ExportRenderer(typeof(Xamarin.Forms.Button), typeof(FlatButtonRenderer))] namespace ProjectName.Droid { public class FlatButtonRenderer : ButtonRenderer { protected override void OnDraw(Android.Graphics.Canvas canvas) { base.OnDraw(canvas); } } }