我有一个Xamarin表单框架的自定义渲染器:CustomFrameRenderer . Xaml示例如下
<controls:ExtendedFrame Margin="2,0,2,0"
BackgroundColor="Red"
HorizontalOptions="FillAndExpand"
OutlineColor="Red"
Padding="0,0,0,0">
<Label Text="This is a test"/>
</controls:ExtendedFrame>
问题是,如果我将bacground颜色绑定到这样的属性,
<controls:ExtendedFrame Margin="2,0,2,0"
BackgroundColor="{Binding FrameBackground}"
HorizontalOptions="FillAndExpand"
OutlineColor="{Binding FrameBackground}"
Padding="0,0,0,0">
框架根据ListView中选择的项目更新颜色 . 现在,如果我使用标准框架,它可以完美地运行 . 但是我使用带圆角的自定义框架,我在Android中遇到此错误 .
Java.Lang.NullPointerException: Attempt to invoke virtual method 'boolean android.graphics.Bitmap.isMutable()' on a null object reference
任何帮助表示赞赏 .
1 回答
即使我有相同的帧控制问题,在我的情况下通过将我的android项目自定义渲染器的基类更改为类型"Frame"的"Visual Element"而不是"Xamarin.Forms.Platform.Android.FrameRenderer"来解决此问题 . 有关更多详细信息,请查看我的博客更新http://www.appliedcodelog.com/2017/12/bug-javalangnullpointerexceptionattempt.html