Dmi*_*lev 2 android xamarin xamarin.forms
我用Xamarin.Forms,我尝试设置 BorderRadius = 10或 BorderRadius = Device.OnPlatform<int>(iOS: 0, Android: 10, WinPhone: 10).在UWP上它是好的(两种方式)但在android BorderRadius上不适用
Gra*_*eng 10
按钮我想从Button更改BorderRadius
问题在于ButtonRendererXamarin Forms for Android.ButtonRendererAndroid 有两种:
Xamarin.Forms.Platform.Android命名空间下的ButtonRenderer和命名空间下的ButtonRendererXamarin.Forms.Platfrom.Android.AppCompat.
默认情况下,在Xamarin.Forms中,它将使用命名空间ButtonRenderer下的Xamarin.Forms.Platfrom.Android.AppCompat按钮来渲染按钮,但此渲染器不会为其创建边框Button,因此这些BorderRadius属性不适用于使用此渲染器渲染的按钮.
要解决此问题,您可以使用Custom Renderer创建自己的自定义按钮,并使用ButtonRendererunder Xamarin.Forms.Platform.Androidnamespace进行渲染.
要为Button创建自定义渲染器,可以参考此讨论.
| 归档时间: |
|
| 查看次数: |
5298 次 |
| 最近记录: |