android - Xamarin 表单图像按钮问题

标签 android xamarin xamarin.android

使用 Xamarin PCL 项目的平台应用程序。我创建了一个带有图像但没有文本的按钮。

 <Button Image="{DynamicResource ProfileImage}" Grid.Row="0" Grid.Column="2" BackgroundColor="Transparent" x:Name="dashboard" StyleId="dashboard" HorizontalOptions="Center" Clicked="TabClicked"></Button>

我遇到了一些 UI 问题。 在 Windows 10 中,它看起来像 -

enter image description here

在android中,它看起来像-

enter image description here

有什么方法可以从 android 中删除这个轮廓边框。

最佳答案

我通过将高度设置为 0 像素来移除 Android 按钮的边框/阴影 with the help of this link

class MyButtonRenderer : ButtonRenderer
    {
        protected override void OnElementChanged(ElementChangedEventArgs<Button> e)
        {
            base.OnElementChanged(e);
            try
            {
                if (Control != null)
                {
                    Control.Elevation = 0;
                }
            }
            catch(Exception ex){}
        }
    }

关于android - Xamarin 表单图像按钮问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42218160/

相关文章:

android - 适用于 Android 2.2 的 VideoView 源代码

xamarin - 当 TableView 列表中的开关更改时,我们如何执行操作?

ios - 在 Xamarin iOS 设计器中围绕 View 创建边框?

Xamarin.Android 版本号似乎不一致

java - 如何在android中的listview中获取行的值

android - 在正方形上映射纹理 (Android)

java - Android Studio 上的 setEGLContextClientVersion(3) 导致错误

ios - 使用 Xamarin 在 iOS 中使用自动布局绘制元素的相对定位

android - 部署 Xamarin Forms Android 应用程序时内存不足

android - Android 4.4 及更低版本上的 SSLHandshakeException