如何在Xamarin Forms上删除按钮的阴影 [英] How to remove the shadow of a button on Xamarin Forms

查看:209
本文介绍了如何在Xamarin Forms上删除按钮的阴影的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有可能吗? 我想删除Xamarin表单上按钮的阴影.

is it possible? I would like to remove the shadow of the buttons on Xamarin Forms.

谢谢

推荐答案

要在Android按钮上删除阴影,您只需要在Droid项目中创建渲染器,并将BackroundColor设置为透明或其他颜色即可.

For delete shadow on button Android you just need create a renderer in project Droid and set BackroundColor with transparent or other color.

对于使用PCL的项目:

For a project using 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中:

<Button BackgroundColor="Transparent" Text="ClickMe"/>

这篇关于如何在Xamarin Forms上删除按钮的阴影的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆