Android 未显示按钮边框颜色xamarin表单
我想在Xamarin表单中将边框颜色设置为button,但此代码不起作用:Android 未显示按钮边框颜色xamarin表单,android,xaml,button,xamarin,xamarin.forms,Android,Xaml,Button,Xamarin,Xamarin.forms,我想在Xamarin表单中将边框颜色设置为button,但此代码不起作用: <Button Text="Test" BorderWidth="5" BorderRadius="2" BorderColor="Red"> </Button> 使用此代码不会显示边框 我也试过,但没用 我已经在安卓4.4(物理设备)和安卓6.0中试过了 (虚拟设备)但也不起作用 解决以下问题 我有三星s3(API 19,安卓4.4 K
<Button Text="Test"
BorderWidth="5"
BorderRadius="2"
BorderColor="Red">
</Button>
使用此代码不会显示边框
我也试过,但没用
我已经在安卓4.4(物理设备)和安卓6.0中试过了
(虚拟设备)但也不起作用
解决以下问题
我有三星s3(API 19,安卓4.4 Kitkat)。
这在我的手机上确实有效
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="MyProject.MyPage" BackgroundColor = "White">
<ContentPage.Content>
<StackLayout Orientation = "Vertical" BackgroundColor = "White">
<Button
Text="Test"
BorderWidth="10"
BorderRadius="5"
BorderColor="Red"
TextColor = "Black"
VerticalOptions = "Start"
HorizontalOptions = "Fill"
BackgroundColor = "White">
</Button>
</StackLayout>
</ContentPage.Content>
</ContentPage>
希望有帮助Xamarin Android中有两个BottonRenderer
Xamarin.Forms.Platform.Android.AppCompat
namesapce下实现绘图按钮边框
main活动是继承的FormsAppCompatiaActivity
,而不是默认情况下在android项目中使用的FormsApplicationActivity
。因此,渲染器位于Xamarin.Forms.Platform.Android.AppCompat
namesapce下。但它并没有实现绘制按钮边框。
如果您想绘制按钮边框,可以使用
Xamarin.Forms.Platform.Android
namesapce.自定义渲染。我测试了一个背景颜色为白色的按钮,它工作了,这就是我问的原因。。但是我不在xaml文件中这么做。你的按钮在内容页中吗?你试过在.cs文件中创建按钮吗?因为我不明白为什么它不起作用..我用问题中添加的链接解决了这个问题,谢谢!与您的解决方案的链接已断开。你们能发布你们的解决方案吗?若我记得很清楚,你们必须给按钮添加背景色。
MyPage()
{
InitializeComponent();
}